Page 1 of 1

### How do I display random numbers

Posted: Tue Mar 04, 2014 10:19 am
I am making a math game. Its a race and to increase your speed you need to answer a math question (2+8) for exsample so i need to random nubers to appear on the screen and answers the player can choose from.

### Re: How do I display random numbers

Posted: Tue Mar 04, 2014 10:27 am
2 options:
Random(range[,....])
choose(0,1,2,3,4,5,6,7,8,15,19,35)

Have a look in manual

edit: use floor with random for whole numbers floor(random(10)) is random 0,1,2,3,4,5,6,7,8,9

See Joskin below posted too, with better explanation

### Re: How do I display random numbers

Posted: Tue Mar 04, 2014 10:27 am
Hi,

For random number use the random() function.

random(x)
Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.

random(a, b)
Generate a random float between a and b, including a but not including b.

For the display use the text object or a sprite font.

### Re: How do I display random numbers

Posted: Tue Mar 04, 2014 10:47 am
You would need a global variable for each number to check if the answer give adds up to correct amount

### Re: How do I display random numbers

Posted: Mon Mar 10, 2014 10:52 am
see this CAPX and work it out