Skip to content

Commit

Permalink
Fix determinism
Browse files Browse the repository at this point in the history
  • Loading branch information
tlbtlbtlb committed Mar 28, 2017
1 parent ccf80b9 commit daf1f45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gym/envs/toy_text/kellycoinflip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gym
from gym import spaces
from gym.utils import seeding
from gym.spaces import prng
# for Generalized Kelly coinflip game distributions:
from scipy.stats import genpareto
import numpy.random
Expand Down Expand Up @@ -77,9 +78,9 @@ def __init__(self, initialWealth=25, edgePriorAlpha=7, edgePriorBeta=3, maxWealt
self.maxRoundsSD=maxRoundsSD

# draw this game's set of parameters:
edge = numpy.random.beta(edgePriorAlpha, edgePriorBeta)
maxWealth = round(genpareto.rvs(maxWealthAlpha, maxWealthM))
maxRounds = round(numpy.random.normal(maxRoundsMean, maxRoundsSD))
edge = prng.np_random.beta(edgePriorAlpha, edgePriorBeta)
maxWealth = round(genpareto.rvs(maxWealthAlpha, maxWealthM, random_state=prng.np_random))
maxRounds = round(prng.np_random.normal(maxRoundsMean, maxRoundsSD))

# add an additional global variable which is the sufficient statistic for the Pareto distribution on wealth cap;
# alpha doesn't update, but x_m does, and simply is the highest wealth count we've seen to date:
Expand Down

0 comments on commit daf1f45

Please sign in to comment.