Beispiel #1
0
def returnToStoredState():
    if random._storedStates is None:
        return ShouldNotOccurError('Tried to return to previous random state without a stored state.')
    
    random.setstate(random._storedStates[0])
    numpy.random.set_state(random._storedStates[1])
    from gtrackcore_memmap.application.RSetup import r
    r('function(state) {.Random.seed <- state}')(random._storedStates[2])
Beispiel #2
0
def setManualSeed(seed):
    random._seed = seed
    
    if seed is None:
        seed = getRandomSeed()
        
    random.seed(seed)
    numpy.random.seed(seed)
    from gtrackcore_memmap.application.RSetup import r
    r('function(seed) {set.seed(seed)}')(seed)
Beispiel #3
0
def storeState():
    from gtrackcore_memmap.application.RSetup import r
    r('runif(1)')
    random._storedStates = [random.getstate(), numpy.random.get_state(), r('.Random.seed')]