From 39cb444b3f02f23f3a44c616c379eb4f0b673a8b Mon Sep 17 00:00:00 2001 From: ksss Date: Mon, 1 Sep 2025 11:52:02 +0900 Subject: [PATCH] Add signature `Random.seed` --- core/random.rbs | 17 +++++++++++++++++ test/stdlib/Random_test.rb | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/core/random.rbs b/core/random.rbs index ee5a6a6d8..b7cca5f60 100644 --- a/core/random.rbs +++ b/core/random.rbs @@ -96,6 +96,23 @@ class Random < RBS::Unnamed::Random_Base | (Float | ::Range[Float] max) -> Float | [T < Numeric] (::Range[T]) -> T + # + # Returns the seed value used to initialize the Ruby system PRNG. This may be + # used to initialize another generator with the same state at a later time, + # causing it to produce the same sequence of numbers. + # + # Random.seed #=> 1234 + # prng1 = Random.new(Random.seed) + # prng1.seed #=> 1234 + # prng1.rand(100) #=> 47 + # Random.seed #=> 1234 + # Random.rand(100) #=> 47 + # + def self.seed: () -> ::Integer + #