Ruby comes with a random number generator. The method to get a randomly chosen number is rand. If you call rand, you'll get a float greater than or equal to. This Ruby example page generates random numbers with the rand method. It uses srand to seed a random stream of numbers. Random. Random provides an interface to Ruby's pseudo- random number generator, or PRNG. The PRNG produces a deterministic sequence of bits which ::new · ::srand · #==.