# netket.hilbert.random.random_state#

class netket.hilbert.random.random_state[source]#

Bases:

random_state(hilb, key, *, size=None, dtype=<class 'numpy.float32'>)

Generates either a single or a batch of uniformly distributed random states.

Parameters:
• hilb (`CustomHilbert`) – The hilbert space

• key – The Jax `jax.random.KeyArray` generated by `jax.random.PRNGKey()`.

• size – If provided, returns a batch of configurations of the form (size, #) if size is an integer or (*size, #) if it is a tuple and where # is the Hilbert space size. By default, a single random configuration with shape (#,) is returned.

• dtype – The dtype of the resulting states.

Example

```>>> import netket, jax
>>> hi = netket.hilbert.Qubit(N=2)
>>> print(hi.random_state(key=jax.random.PRNGKey(0)))
[1. 0.]
>>> print(hi.random_state(size=2, key=jax.random.PRNGKey(1)))
[[0. 1.]
[0. 0.]]
```
random_state(hilb, key, size, dtype)
random_state(hilb, key, size: NoneType, *, dtype)
random_state(hilb, key, size: tuple[int] | tuple[int, int] | tuple[int, int, int], *, dtype)
random_state(hilb, key, size: int, *, dtype)
random_state(hilb: netket.hilbert.DoubledHilbert, key, batches: int, *, dtype)
random_state(hilb: netket.hilbert.Fock, key, batches: int, *, dtype=<class 'numpy.float32'>)
random_state(hilb: netket.hilbert.Qubit, key, batches: int, *, dtype)
random_state(hilb: netket.hilbert.Spin, key, batches: int, *, dtype=<class 'numpy.float32'>)
random_state(hilb: netket.hilbert.TensorHilbert, key, batches: int, *, dtype)
random_state(hilb: netket.hilbert.Particle, key, batches: int, *, dtype)

If no periodic boundary conditions are present particles are positioned normally distributed around the origin.

If periodic boundary conditions are present the particles are positioned uniformly inside the box and a small gaussian noise is added on top. If periodic boundary conditions are chosen only for certain dimensions, the periodic initialization is used for all of those dimensions and the free initialization is used for all the other ones.

random_state(hilb: netket.experimental.hilbert.SpinOrbitalFermions, key, batches: int, *, dtype)