'Set on device RNG states to values given by "state" input.
Arguments:
state (np.array or None): an array of uint32 values used to
set the state of the on device LFSRs.
if set to None, the state will be created
randomly'

def _set_rand_state_dev(self, state=None):

    ctx = drv.Context.get_current()
    if (state is None):
        state = self._gen_dev_randstate()
    if (ctx in self.context_rand_state_map):
        rand_state = self.context_rand_state_map[ctx]
    else:
        rand_state = drv.mem_alloc(state.nbytes)
        self.context_rand_state_map[ctx] = rand_state
    drv.memcpy_htod(rand_state, state)
    self.context_rand_state_alive[ctx] = True
    return
