mirror of
https://github.com/samsonjs/mystery7-simulator.git
synced 2026-04-27 15:07:42 +00:00
seed RNG for each session
This commit is contained in:
parent
efacab0822
commit
cf8a859d97
2 changed files with 2 additions and 3 deletions
|
|
@ -36,8 +36,6 @@ class Roulette
|
||||||
@sets[:z].insert(2, 5)
|
@sets[:z].insert(2, 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
@rng = @options[:seed] ? Random.new(@options[:seed]) : Random.new
|
|
||||||
|
|
||||||
# generated numbers are from 0 to max
|
# generated numbers are from 0 to max
|
||||||
@max = @options[:american] ? 38 : 37
|
@max = @options[:american] ? 38 : 37
|
||||||
|
|
||||||
|
|
@ -67,6 +65,7 @@ class Roulette
|
||||||
@counts = Hash.new { 0 }
|
@counts = Hash.new { 0 }
|
||||||
@closing = false
|
@closing = false
|
||||||
@closed = false
|
@closed = false
|
||||||
|
@rng = @options[:seed] ? Random.new(@options[:seed]) : Random.new
|
||||||
|
|
||||||
@options[:spins].times do |i|
|
@options[:spins].times do |i|
|
||||||
break if @options[:spins] - i < 10 && @cumulative_net > 100
|
break if @options[:spins] - i < 10 && @cumulative_net > 100
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ def main
|
||||||
|
|
||||||
roulette = Roulette.new(options.dup)
|
roulette = Roulette.new(options.dup)
|
||||||
|
|
||||||
puts ">>> Seed: #{roulette.seed}"
|
# puts ">>> Seed: #{roulette.seed}"
|
||||||
|
|
||||||
overall_status = {
|
overall_status = {
|
||||||
:net => 0,
|
:net => 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue