+ 1
Can someone please send link for random methods in java. I can't find it. Thanks
2 Respostas
+ 5
import java.util.Random;
Random rand = new Random();
int x = rand.nextInt(40);
creates a random integer between 0 and 39, inclusive.
int x = rand.nextInt(40) + 1;
creates a random integer between 1 and 40, exclusive
Look up the Random class, it has a whole slew of different random methods, for doubles and integers and etc...
+ 1
Robert Atkins thanks