Javatpoint Logo
Javatpoint Logo

Java Random nextLong() Method

The nextLong() method of Random class returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

Syntax

Parameters

NA

Return Value

The nextLong() method returns the next pseudorandom, uniformly distributed long value.

Example 1

Test it Now

Output:

Random Integer value : 3977537424970713389
Random Integer value : 5733671541347552387

Example 2

Test it Now

Output:

7543819037091046117 
-3342512197386667364 
-4465337898535811745 
2349346495373509042 
-6952569592634674749

Example 3

Test it Now

Output:

FirstName-Reema      :  LastName-Panda    : [email protected]         : Id--6149450654700259232
FirstName-Geetanjali :  LastName-Sharma   : [email protected]   : Id--1351029507738091616
FirstName-Vineet     :  LastName-Tanjea   : [email protected]       : Id--2724724873264125475
FirstName-Himanshu   :  LastName-Bhardwaj : [email protected] : Id--2199305912644374368
Next TopicJava Random




Help Others, Please Share

facebook twitter pinterest