We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2f98107 + ddf62da commit 18c0c63Copy full SHA for 18c0c63
Language/Variables/Variable Scope & Qualifiers/static.adoc
@@ -75,11 +75,11 @@ int randomWalk(int moveSize){
75
76
place = place + (random(-moveSize, moveSize + 1));
77
78
- if (place < randomWalkLowRange){ // check lower and upper limits
79
- place = place + (randomWalkLowRange - place); // reflect number back in positive direction
+ if (place < randomWalkLowRange){ // check lower and upper limits
+ place = randomWalkLowRange + (randomWalkLowRange - place); // reflect number back in positive direction
80
}
81
else if(place > randomWalkHighRange){
82
- place = place - (place - randomWalkHighRange); // reflect number back in negative direction
+ place = randomWalkHighRange - (place - randomWalkHighRange); // reflect number back in negative direction
83
84
85
return place;
0 commit comments