红宝石 |随机 ==()函数
Random#==()是一个 Random 类方法,用于检查两个随机值是否相等。
Syntax: Random.==()
Parameter: Random values
Return: true – if random values are equal otherwise return false
示例 #1:
# Ruby code for Random.==() method
# declaring Random value
date_a = Random.new(123)
# declaring Random value
date_b = Random.new(123)
# == value
puts "Random == form : #{date_a == date_b}\n\n"
输出 :
Random == form : true
示例 #2:
# Ruby code for Random.==() method
# declaring Random value
date_a = Random.new(123)
# declaring Random value
date_b = Random.new()
# == value
puts "Random == form : #{date_a == date_b}\n\n"
输出 :
Random == form : false