Java Random next() Method

The next() method of Java Random class returns the next pseudorandom value from the random number generator's sequence.

Syntax

Parameters

bits- It is the random bits

Return Value

The next () method returns the next pseudorandom number.

Example 1

Output:

Next value returns = 438

Example 2

Output:

1. Next value returns = 212
2. Next value returns = 156
3. Next value returns = 324
4. Next value returns = 0