File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,23 @@ class Random < RBS::Unnamed::Random_Base
9696 | (Float | ::Range[Float] max) -> Float
9797 | [T < Numeric] (::Range[T]) -> T
9898
99+ # <!--
100+ # rdoc-file=random.c
101+ # - Random.seed -> integer
102+ # -->
103+ # Returns the seed value used to initialize the Ruby system PRNG. This may be
104+ # used to initialize another generator with the same state at a later time,
105+ # causing it to produce the same sequence of numbers.
106+ #
107+ # Random.seed #=> 1234
108+ # prng1 = Random.new(Random.seed)
109+ # prng1.seed #=> 1234
110+ # prng1.rand(100) #=> 47
111+ # Random.seed #=> 1234
112+ # Random.rand(100) #=> 47
113+ #
114+ def self.seed : () -> ::Integer
115+
99116 # <!--
100117 # rdoc-file=random.c
101118 # - srand(number = Random.new_seed) -> old_seed
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ def test_bytes
2929 Random , :bytes , 0
3030 end
3131
32+ def test_seed
33+ assert_send_type "() -> ::Integer" ,
34+ Random , :seed
35+ end
36+
3237 def test_new_seed
3338 assert_send_type "() -> ::Integer" ,
3439 Random , :new_seed
You can’t perform that action at this time.
0 commit comments