Ruby | Random srand() function
Last Updated :
17 Dec, 2019
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 :
date_a = Random.srand()
puts "Random form : #{date_a}\n\n"
|
Output :
Random form : 97145396384347815026726176289224049730
Example #2 :
date_b = Random.srand( 12 )
puts "Random form : #{date_b}\n\n"
|
Output :
Random form : 275725175971615768898475651769765923352
Share your thoughts in the comments
Please Login to comment...