Stop Random()
in
Programming Questions
•
6 months ago
Hello all.
I've been recently trying to develop a random direction generator "prototype", and an issue comes up.
No exception, but rather the program isn't doing what it's supposed to do.
I want to stop the random() function/action for generating more numbers in this code:
I've been recently trying to develop a random direction generator "prototype", and an issue comes up.
No exception, but rather the program isn't doing what it's supposed to do.
I want to stop the random() function/action for generating more numbers in this code:
- int r = 2;
- byte dir;
- while (r > 1) {
- dir = byte(floor(random(4)));
- r = 0;
- println(dir);
- }
Nothing complicated, but the program continuously prints out a random number, when it should've stopped.
Why is it doing that?
- MenteCode
Why is it doing that?
- MenteCode
1