Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Random.new

Random.new(seed = Random.new_seed) → prng

Creates a new PRNG using seed to set the initial state. If seed is omitted, the generator is initialized with Random.new_seed.

See Random.srand for more information on the use of seed values.

Ruby version changes

  1. 3.0
See also .bytes .new_seed .rand also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0