Java Random setSeed() Method

The setSeed() method of Random class sets the seed of the random number generator using a single long seed.

Syntax

Parameters

seed- It is the initial seed

Return Value

Example 1

Output:

Random Integer value : -1882931681
Random Integer value : -1150867590

Example 2

Output:

Error:(11, 40) java: 'void' type not allowed here

The setSeed() method has a void return type, and 'void' type are not allowed in system.out.println() function.