Ruby | Random new() function
Random#new() : new() is a Random class method which creates a new PRNG using seed to set the initial state.
Syntax: Random.new()
Parameter: Random values
Return: a new PRNG using seed to set the initial state.
Example #1 :
# Ruby code for Random.new() method # declaring Random value date_a = Random. new () # new arbitrary random state puts "Random new form : #{date_a}\n\n" |
Output :
Random new form : #
Example #2 :
# Ruby code for Random.new() method # declaring Random value date_b = Random. new () # new arbitrary random state puts "Random new form : #{date_b}\n\n" |
Output :
Random new form : #
Contact Us