Open In App

Ruby | Random new_seed() function

Random#new_seed() : new_seed() is a Random class method which returns a random seed value.

Syntax: Random.new_seed()



Parameter: Random values

Return: a random seed value



Example #1 :




# Ruby code for Random.new_seed() method
  
# declaring Random value
date_a = Random.new_seed()
  
# new arbitrary random value
puts "Random new_seed form : #{date_a}\n\n"

Output :

Random new_seed form : 136900168362527727761982174954109934532

Example #2 :




# Ruby code for Random.new_seed() method
  
# declaring Random value
date_b = Random.new_seed()
  
# new arbitrary random value
puts "Random new_seed form : #{date_b}\n\n"

Output :

Random new_seed form : 271255499858368204233299869842415724010

Article Tags :