How do you use Math.random to generate random ints?
My code is:
int abc= (Math.random()*100); System.out.println(abc);
All it prints out is 0, how can I fix this?
Cast abc to an integer.
(int)(Math.random()*100);
1.4m articles
1.4m replys
5 comments
56.9k users