Lines Matching defs:state

28    Before using, initialize the state by using init_genrand(seed)
94 void *state = _PyModule_GetState(module);
95 assert(state != NULL);
96 return (_randomstate *)state;
107 uint32_t state[N];
131 mt = self->state;
190 mt = self->state;
213 mt = self->state;
303 _randomstate *state = _randomstate_type(Py_TYPE(self));
304 n = PyObject_CallOneArg(state->Long___abs__, arg);
386 getstate() -> tuple containing the current state.
393 PyObject *state;
397 state = PyTuple_New(N+1);
398 if (state == NULL)
401 element = PyLong_FromUnsignedLong(self->state[i]);
404 PyTuple_SET_ITEM(state, i, element);
409 PyTuple_SET_ITEM(state, i, element);
410 return state;
413 Py_DECREF(state);
422 state: object
425 setstate(state) -> None. Restores generator state.
429 _random_Random_setstate(RandomObject *self, PyObject *state)
437 if (!PyTuple_Check(state)) {
439 "state vector must be a tuple");
442 if (PyTuple_Size(state) != N+1) {
444 "state vector is the wrong size");
449 element = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(state, i));
455 index = PyLong_AsLong(PyTuple_GET_ITEM(state, i));
459 PyErr_SetString(PyExc_ValueError, "invalid state");
464 self->state[i] = new_state[i];
532 _randomstate *state = _randomstate_type(Py_TYPE(self));
534 if ((Py_IS_TYPE(self, (PyTypeObject *)state->Random_Type) ||
535 Py_TYPE(self)->tp_init == ((PyTypeObject*)state->Random_Type)->tp_init) &&
562 "Random() -> create a random number generator with its own internal state.");
587 _randomstate *state = get_random_state(module);
589 state->Random_Type = PyType_FromModuleAndSpec(
591 if (state->Random_Type == NULL) {
594 if (PyModule_AddType(module, (PyTypeObject *)state->Random_Type) < 0) {
610 state->Long___abs__ = PyObject_GetAttrString(longtype, "__abs__");
612 if (state->Long___abs__ == NULL) {