diff options
author | Benoit Daloze <eregontp@gmail.com> | 2022-03-28 17:47:04 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2022-03-28 17:47:04 +0200 |
commit | 8db4f25bf4327f169902afd9ea8f4b03b65656f0 (patch) | |
tree | ad61b99fb2d5ebfe9c07de8c2b5885e80d20b8e1 /spec/ruby/core/random | |
parent | ae650f0372e10cea4d695769b1fcdc23a76fdf17 (diff) |
Update to ruby/spec@aaf998f
Diffstat (limited to 'spec/ruby/core/random')
-rw-r--r-- | spec/ruby/core/random/rand_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/random/rand_spec.rb b/spec/ruby/core/random/rand_spec.rb index 6ea7eece5f..9244177ab5 100644 --- a/spec/ruby/core/random/rand_spec.rb +++ b/spec/ruby/core/random/rand_spec.rb @@ -205,6 +205,11 @@ describe "Random#rand with Range" do Random.new(42).rand(0..1.0).should be_kind_of(Float) end + it "returns a float within a given float range" do + Random.new(42).rand(0.0...100.0).should == 37.454011884736246 + Random.new(42).rand(-100.0...0.0).should == -62.545988115263754 + end + it "raises an ArgumentError when the startpoint lacks #+ and #- methods" do -> do Random.new.rand(Object.new..67) |