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

2021/12/2

I need Help about GetRandomNumber();

D_BUSTER9 D_BUSTER9

2021/12/2

#
So i want to use this func but just for random some place like just randoming for x(23, 43 ,65) y(0) not randoming between 0-100, just x23, x43, x65 Anyone know how to deal with this?
danpost danpost

2021/12/2

#
D_BUSTER9 wrote...
So i want to use this func but just for random some place like just randoming for x(23, 43 ,65) y(0) not randoming between 0-100, just x23, x43, x65 Anyone know how to deal with this?
int[] xs = new int[] { 23, 43, 65 };
int x = xs[Greenfoot.getRandomNumber(3)];
D_BUSTER9 D_BUSTER9

2021/12/3

#
Ooooo, i see. Thank you very much bro :D
You need to login to post a reply.