Open In App

Ruby | Random new() function

Last Updated : 17 Dec, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
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
# 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
# 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 : #


Next Article

Similar Reads