+ 1

How the Random number is generated in Java using Random class ?

Logic behind the process of generating random numbers

23rd Apr 2018, 4:05 PM
Deekshith K
Deekshith K - avatar
2 RĂ©ponses
+ 20
import java.util.Random; public class Program { public static void main(String[] args) { Random rand = new Random(); int value = rand.nextInt(50); System.out.println(value) ; } } java.util.Random class 👆is the built-in method in Java to generate random number... not truly random but uniformly distributed based on mathematical functions... good enough in most cases the argument 50 passed provide the upper bound limit... check this out for more 👇 https://www.geeksforgeeks.org/generating-random-numbers-in-java/
23rd Apr 2018, 4:31 PM
🌛DT🌜
🌛DT🌜 - avatar