Ruby | Random srand() function
Random#srand() : srand() is a Random class method which returns system pseudo-random number.
Syntax: Random.srand()
Parameter: Random values
Return: system pseudo-random number.
Example #1 :
# Ruby code for Random.srand() method # declaring Random value date_a = Random.srand() # new arbitrary random value puts "Random form : #{date_a}\n\n" |
Output :
Random form : 97145396384347815026726176289224049730
Example #2 :
# Ruby code for Random.srand() method # declaring Random value date_b = Random.srand( 12 ) # new arbitrary random value puts "Random form : #{date_b}\n\n" |
Output :
Random form : 275725175971615768898475651769765923352
Contact Us