This site requires JavaScript, please enable it in your browser!
Greenfoot back
dyl_fisher
dyl_fisher wrote ...

2015/4/8

random number within a range

dyl_fisher dyl_fisher

2015/4/8

#
How can i make a getRandomNumber() for a y value so that it will only return a value for y in the bottom half of the screen
danpost danpost

2015/4/8

#
The general formula for any range of numbers can be shown in line 3 of the following:
int minimum = getHeight()/2;
int maximum = getHeight();
int randomRangeValue = minimum + Greenfoot.getRandomNumber( maximum - minimum + 1 );
dyl_fisher dyl_fisher

2015/4/8

#
Thanks so much it worked :)
You need to login to post a reply.