0
How do I make a randomizer
how do make one i want one for live streams
3 odpowiedzi
+ 2
there is a function in the math class called random, but it only gives a random floating point number between 0 and 1. You can call it like this:
double randNum = Math.random();
You can then multiply it by any integer to increase the range:
double randNum = Math.random() * 10; // random number 0 to 10
Then cast it to an int if you want a whole number:
int randNum = (int)(Math.random() * 10);
+ 2
Random r = new Random();
int number=r.nextInt(5);
System.out.println(number);
0
use random class