Small help wth random() producing similar results
in
Programming Questions
•
11 months ago
Can anyone please explain why the code below produces THIS output?
285
44
214
285
44
214
Every time I get 3 different numbers, but every set of 3 is the same. How would I go about fixing this? Maybe this is a case of "brain on holiday" for me again, but I'm confused as heck and I can't say I recall anything similar I've done in the past having this problem.
285
44
214
285
44
214
Every time I get 3 different numbers, but every set of 3 is the same. How would I go about fixing this? Maybe this is a case of "brain on holiday" for me again, but I'm confused as heck and I can't say I recall anything similar I've done in the past having this problem.
- void newGameSetup() {
- for (int foo = 0; foo < 2; foo++) {
- for (int bar = 0; bar < 3; bar++) {
- objLoc = append(objLoc, int(random(360)));
- numberOfObjects++;
- println(objLoc[bar]);
- }
- for (int bar = 0; bar < 3; bar++) {
- objLoc = append(objLoc, int(random(360)));
- numberOfObjects++;
- println(objLoc[bar]);
- }
- }
- }
1