• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(11)  |  Call(11)  |  Derive(0)  |  Import(0)
Return internal state; can be passed to setstate() later.

src/y/t/yt-1.7/yt/extensions/lightcone/UniqueSolution.py   yt(Download)
        state = None
    else:
        rand.seed(seed)
        state = rand.getstate()
 
    failDigits = str(int(na.log10(failures))+1)
 
    while (len(uniqueSeeds) < solutions):
        # Create new random seed.
        if (recycle and master is not None):
            newSeed = master
            if state is not None: rand.setstate(state)
            newRecycleSeed = rand.randint(1, 1e9)
            state = rand.getstate()
        else:
            if state is not None: rand.setstate(state)
            newSeed = rand.randint(1, 1e9)
            state = rand.getstate()
            if recycle:
                master = newSeed
                recycleFails = 0

src/c/s/csa-0.0.1/csa/_elementary.py   csa(Download)
    def __init__ (self, p):
        _cs.Mask.__init__ (self)
        self.p = p
        self.state = _random.getstate ()
 
    def startIteration (self, state):
        _random.setstate (self.state)
    def __init__ (self, N):
        _cs.Mask.__init__ (self)
        self.N = N
        self.randomState = _random.getstate ()
        self.npRandomState = _numpy.random.get_state ()
        # The following yields the same result on all processes.
        # We should add a seed function to the CSA.

src/x/g/xgcode-HEAD/PhyLikelihood.py   xgcode(Download)
        raise SimulationError('each leaf should have a unique name')
    # Save the rng state if we are using a seed.
    if seed is not None:
        old_rng_state = random.getstate()
    # Seed the rng if we are using a seed.
    if seed is not None:
        random.seed(seed)

src/c/s/csa-0.0.1/csa/_misc.py   csa(Download)
    def __init__ (self, valueSet):
        _cs.Mask.__init__ (self)
        self.valueSet = valueSet
        self.state = _random.getstate ()
 
    def startIteration (self, state):
        _random.setstate (self.state)

src/n/o/Nodes-1.2/rfNEAT/population.py   Nodes(Download)
        # dumps the population
        pickle.dump(self, file, protocol=2)
        # dumps the current random state
        pickle.dump(random.getstate(), file, protocol=2)
        file.close()
 
    def __create_population(self, nodes_dict):

src/e/n/EnthoughtBase-3.0.5/enthought/util/random_state.py   EnthoughtBase(Download)
    def update(self):
        self.stats_seed = get_seed()
        self.random_state = random.getstate()
 
class RandomStateManager:
 
    # todo - does it make any sense to use a stack structure?

src/s/h/shedskin-HEAD/tests/172.py   shedskin(Download)
 
 
import random
 
# --- module-level functions
random.seed(37)
rstate = random.getstate()   # (state is not cross-compatible with CPython)

src/o/b/obfuscate-0.2.2/testsuite.py   obfuscate(Download)
    def test_randchars_choice(self):
        """Test the randchars function with the default choice function."""
        import random
        save = random.getstate()
        try:
            random.seed(14562)
            self.reset()