Skip to content
Related Articles

Related Articles

Ruby | Random ==() function

Improve Article
Save Article
Like Article
  • Last Updated : 17 Dec, 2019

Random#==() is a Random class method which checks whether the two random values are equal.

Syntax: Random.==()

Parameter: Random values

Return: true – if random values are equal otherwise return false

Example #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"

Output :

Random == form : true

Example #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"

Output :

Random == form : false

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!