diff options
Diffstat (limited to 'spec/ruby/core/kernel/rand_spec.rb')
-rw-r--r-- | spec/ruby/core/kernel/rand_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/rand_spec.rb b/spec/ruby/core/kernel/rand_spec.rb index 843b5d10a2..a82b4fba74 100644 --- a/spec/ruby/core/kernel/rand_spec.rb +++ b/spec/ruby/core/kernel/rand_spec.rb @@ -138,6 +138,16 @@ describe "Kernel.rand" do rand(KernelSpecs::CustomRangeFloat.new(1.0)..KernelSpecs::CustomRangeFloat.new(42.0)).should be_an_instance_of(KernelSpecs::CustomRangeFloat) rand(Time.now..Time.now).should be_an_instance_of(Time) end + + it "is random on boot" do + results = 2.times.map { + out = ruby_exe('p rand', options: '--disable-gems') + Float(out) + } + results.size.should == 2 + # this is technically flaky, but very unlikely in a good distribution + results[0].should_not == results[1] + end end describe "Kernel#rand" do |