rand()#that will give you a random float between 0 and 10
rand(num)#that will give you a random integer between 0 and the number num
rand(first...second)#that will give you a random
#integer between first and second
puts rand(25) # from 0 to 25
puts rand(1..25) # from 1 to 25
puts rand(5...25) # from 1 to 24
puts rand(3.14..102.54) # from 3.14 to 102.54
Code Example |
---|
Ruby :: ruby map with index |
Ruby :: rails destroy not working |
Ruby :: max keys from hash ruby |
Ruby :: rails remove foreign key |
Ruby :: how to get current month end date in ruby |
Ruby :: rails g model |
Ruby :: rails datatypes |
Ruby :: rails reset database |
Ruby :: rails date format dd/mm/yyyy |
Ruby :: auto load path rails |
Ruby :: ruby boolean variable |
Ruby :: ruby reverse string |
Ruby :: uper case in ruby |
Ruby :: rails send email from console |
Ruby :: rails setup test db |
Ruby :: Seconds to HH:MM in Ruby |
Ruby :: ruby merge array of hashes into one hash |
Ruby :: ruby while |
Ruby :: true sting to true in rails |
Ruby :: rbenv not changing version |
Ruby :: ruby loop using integer |
Ruby :: rails log levels |
Ruby :: ruby merge arrays unique |
Ruby :: intermediate rails project |
Ruby :: ruby execute code in string |
Ruby :: ruby negative indices fizz buzz |
Ruby :: rails ago |
Ruby :: call api in ruby |
Ruby :: hello world ruby |
R :: r remove na from dataset |