Would you say that the randomizer of CC65 is a good one?
https://github.com/cc65/cc65/blob/maste ... mon/rand.s
My problem is: I have a character in a game that has a 3 out of 8 chance to do the motion where it is attackable.
My call is basically this:
But the attackable movement is triggered quite rarely.
Yesterday, the character did a non-attackable movement probably 10 times in a row before I finally gave up.
(In the moment, I only have one distinct non-attackable movement, so I couldn't check in how much that second random call switched between both alternatives.)
Is this normal? Or is the randomizer crap?
https://github.com/cc65/cc65/blob/maste ... mon/rand.s
My problem is: I have a character in a game that has a 3 out of 8 chance to do the motion where it is attackable.
My call is basically this:
Code:
/* 3 out of 8 chance
(random values can go from 0-7)
to be attackable. */
if ((rand() & 0x07) < 3)
PrepareMovementAttackable();
/* If non-attackable,
the movement is chosen by a
1 to 1 (i.e. 1 out of 2) chance. */
else if ((rand() & 0x01) == 0)
PrepareMovementNonAttackable1();
else
PrepareMovementNonAttackable2();
(random values can go from 0-7)
to be attackable. */
if ((rand() & 0x07) < 3)
PrepareMovementAttackable();
/* If non-attackable,
the movement is chosen by a
1 to 1 (i.e. 1 out of 2) chance. */
else if ((rand() & 0x01) == 0)
PrepareMovementNonAttackable1();
else
PrepareMovementNonAttackable2();
But the attackable movement is triggered quite rarely.
Yesterday, the character did a non-attackable movement probably 10 times in a row before I finally gave up.
(In the moment, I only have one distinct non-attackable movement, so I couldn't check in how much that second random call switched between both alternatives.)
Is this normal? Or is the randomizer crap?