Quick question about random()
in
Programming Questions
•
1 year ago
so if you put
float a = random(0,3);
it would keep on generating random numbers between 0 and 3.
But I only want it to generate one number what do i do?
My code looks like:
float a = random(0,3);
it would keep on generating random numbers between 0 and 3.
But I only want it to generate one number what do i do?
My code looks like:
- float a = random(0,3);
- if(a < 1);
- {
- .....
- ......
- }
- if((a >= 1)&&(a < 2));
- {
- .....
- .....
- }
- if((a >= 2)&&(a <= 3));
- {
- ....
- ....
- }
1