clbustos / distribution

Statistical Distributions multi library wrapper. Uses Ruby by default and C (statistics2/GSL) or Java extensions where available.
Other
141 stars 52 forks source link

Cannot reproduce `Distribution::Normal::rng` sampling sequence with fixed seed #23

Open giuse opened 8 years ago

giuse commented 8 years ago

Passing a fixed seed is necessary to allow debugging of functions using Distribution sampling.

Distribution::Normal.rng(0, 1, 1) == Distribution::Normal.rng(0, 1, 1)
# => false

Should return true instead.

Version info:

p Distribution::Normal.rng(0, 1, 1)
# => #<Proc:0x000000013533f0@/home/user/.rvm/gems/ruby-2.2.1/gems/distribution-0.7.3/lib/distribution/normal/ruby.rb:17 (lambda)>

Notably, you seem to have a test set up in spec/normal_spec.rb:27, but I can't get it executed.

# cd to gem folder
rspec spec/normal_spec.rb:27 2>&1 | grep 'seed'
# => no output
rspec spec/normal_spec.rb 2>&1 | grep 'seed'
# => no output
rspec spec/ 2>&1 | grep 'seed'
# => no output
rspec 2>&1 | grep 'seed'
# => no output