help generating completely random numbers
Hello everyone, it's been a while since I posted on the forums.
I am having some difficulties with a simple, but unresolvable issue. My game needs to generate constantly random numbers between 1 and 3. This may sound easy but when I try to use the normal method:
every 5 seconds
random(1,3)
I get about 90% of ones and twos (for example), and only a 10% of threes. This is surely not random.
Does anyone have an idea for a work around? maybe using game.time to generate a random number?
Thanks in advance
Giacomo
I am having some difficulties with a simple, but unresolvable issue. My game needs to generate constantly random numbers between 1 and 3. This may sound easy but when I try to use the normal method:
every 5 seconds
random(1,3)
I get about 90% of ones and twos (for example), and only a 10% of threes. This is surely not random.
Does anyone have an idea for a work around? maybe using game.time to generate a random number?
Thanks in advance
Giacomo
Comments
I have a car (the actor) which I spawn 7 times in the scene which I then recycle when they go off screen. There are three colours for the cars: one green, one red and one yellow.
I need to assign each car a colour randomly. To do this I do:
change attribute: self.carimage to random (1,3)
when self.carimage is = 1
change image....
when self.carimage is = 2 ...etc
I also say this when I recycle the car:
when car is off screen:
change attribute: self.carimage to random (1,3)
Every time I play the game I get 3 cars one colour, 3 cars another and 1 car for the last colour.
understand?
MH
Thanks guys
Giacomo
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Tshirt, will it be quite self-explanitory once tables arrive? (thanks!)
Giacomo
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS