Trying to generate random numbers between custom range in Ruby

Asked By 0 points N/A Posted on -
qa-featured

How to create a custom function to generate an output which will be a random number between two numbers. The two numbers can either be given by the user, or can be read from an existing array. Here are some conditions which I will explain with examples. I may want to generate a random number between 11 and 33. 11 inclusive and 33 exclusive. Similarly a random number between 42 and 52 both numbers exclusive etc. Hope i have stated the problem correctly and clearly. Can any body please guide me on random numbers on ruby on rails?

SHARE

Login/Register to Answer

Related Questions