Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « numpy.random »

Classe « SeedSequence »

Informations générales

Héritage

builtins.object
    SeedSequence

Définition

class SeedSequence(builtins.object):

Description [extrait de SeedSequence.__doc__]

    SeedSequence(entropy=None, *, spawn_key=(), pool_size=4)

    SeedSequence mixes sources of entropy in a reproducible way to set the
    initial state for independent and very probably non-overlapping
    BitGenerators.

    Once the SeedSequence is instantiated, you can call the `generate_state`
    method to get an appropriately sized seed. Calling `spawn(n) <spawn>` will
    create ``n`` SeedSequences that can be used to seed independent
    BitGenerators, i.e. for different threads.

    Parameters
    ----------
    entropy : {None, int, sequence[int]}, optional
        The entropy for creating a `SeedSequence`.
    spawn_key : {(), sequence[int]}, optional
        A third source of entropy, used internally when calling
        `SeedSequence.spawn`
    pool_size : {int}, optional
        Size of the pooled entropy to store. Default is 4 to give a 128-bit
        entropy pool. 8 (for 256 bits) is another reasonable choice if working
        with larger PRNGs, but there is very little to be gained by selecting
        another value.
    n_children_spawned : {int}, optional
        The number of children already spawned. Only pass this if
        reconstructing a `SeedSequence` from a serialized form.

    Notes
    -----

    Best practice for achieving reproducible bit streams is to use
    the default ``None`` for the initial entropy, and then use
    `SeedSequence.entropy` to log/pickle the `entropy` for reproducibility:

    >>> sq1 = np.random.SeedSequence()
    >>> sq1.entropy
    243799254704924441050048792905230269161  # random
    >>> sq2 = np.random.SeedSequence(sq1.entropy)
    >>> np.all(sq1.generate_state(10) == sq2.generate_state(10))
    True
    

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
entropy<attribute 'entropy' of 'numpy.random.bit_generator.SeedSequence' objects>
n_children_spawned<attribute 'n_children_spawned' of 'numpy.random.bit_generator.SeedSequence' objects>
pool<attribute 'pool' of 'numpy.random.bit_generator.SeedSequence' objects>
pool_size<attribute 'pool_size' of 'numpy.random.bit_generator.SeedSequence' objects>
spawn_key<attribute 'spawn_key' of 'numpy.random.bit_generator.SeedSequence' objects>
state<attribute 'state' of 'numpy.random.bit_generator.SeedSequence' objects>

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__reduce__
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__setstate__
generate_state
spawn

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __hash__, __init_subclass__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__