Answers for "java rand method"

2

java random

String id = UUID.randomUUID().toString();
Posted by: Guest on February-25-2021
1

java random

import java.util.Random;
//If there is a need to reproduce the same sequence of random numbers, 
//we have to specify a seed to the constructor, like 100000
Random random = new Random(100000);    //using a seed
System.out.println(random.nextInt(5)); // print one random 0, 1, 2, 3, 4
System.out.println(random.nextInt(5));
Posted by: Guest on October-17-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language