With ruby on rails, ruby, how can I randomly select either 4 or 5?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since rand(num) chooses a value between 0 and
num, non-inclusive, there’s a 50% chance of 0 being chosen. Thus,four_or_fivewill be 4 or 5 with equal probability.