Loading...
Uploaded by onlivegamer on Sep 21, 2010
pm me with questions or requests
Science & Technology
Standard YouTube License
I thought it was this way: "sam" is an instance and Random is an object. "new Random()" creates a object and "sam" is the instance of "new Random()"
Traceguy 3 weeks ago
This method repeat randoms.
manelirim 1 month ago
¿porqué a mi no me funciona? ¿Porqué no me deja importar java.util.Random? :(
Nuevametal 2 months ago
Random don't working to me why?
pantelisariz 3 months ago
@anvandarnamnnr1 You would need to put (sam.nextInt(49)+1);
ClTIZEN 3 months ago
i did get a 0 from (sam.nextInt(49+1));
anvandarnamnnr1 5 months ago
Actually nextInt(50) returns an integer between 0 and 49, both included. So nextInt(50)+1 would return only integers between 1 and 50
mrgnudk 5 months ago
its called Libraries Radom util ect are libraries :D
stefysjg 10 months ago
Great tutorial! But what about doubles?
GameDag 10 months ago
System.out.println (sam.nextInt(50)+1);
because start from 0 (inclusive 0), and end at 50 (but EXCLUSIVE 50, so real end is at 49 -> +1 = 50)
Tilkinho25 1 year ago
Load more suggestions
I thought it was this way: "sam" is an instance and Random is an object. "new Random()" creates a object and "sam" is the instance of "new Random()"
Traceguy 3 weeks ago
This method repeat randoms.
manelirim 1 month ago
¿porqué a mi no me funciona? ¿Porqué no me deja importar java.util.Random? :(
Nuevametal 2 months ago
Random don't working to me why?
pantelisariz 3 months ago
@anvandarnamnnr1 You would need to put (sam.nextInt(49)+1);
ClTIZEN 3 months ago
i did get a 0 from (sam.nextInt(49+1));
anvandarnamnnr1 5 months ago
Actually nextInt(50) returns an integer between 0 and 49, both included. So nextInt(50)+1 would return only integers between 1 and 50
mrgnudk 5 months ago
its called Libraries Radom util ect are libraries :D
stefysjg 10 months ago
Great tutorial! But what about doubles?
GameDag 10 months ago
System.out.println (sam.nextInt(50)+1);
because start from 0 (inclusive 0), and end at 50 (but EXCLUSIVE 50, so real end is at 49 -> +1 = 50)
Tilkinho25 1 year ago