Skip to content

RandomState

A random state with \(\mathcal{N}(0, 1)\) normal distributed coefficients.

Sources: random_state.hpp ยท random_state.cpp


Constructors

RandomState(int64_t seed = 42, bool normalized = true);
RandomState(seed::Int64 = 42, normalized::Bool = true)
Parameter Description
seed random seed determining which random numbers are put
normalized flag whether the State is normalized

Usage Example

auto block = Spinhalf(2);
auto state = State(block, false);  // complex State
auto rstate1 = RandomState(1234);
fill(state, rstate1);
XDIAG_SHOW(state.vectorC());

auto rstate2 = RandomState(4321);
fill(state, rstate2);
XDIAG_SHOW(state.vectorC());

fill(state, rstate1);
XDIAG_SHOW(state.vectorC());
block = Spinhalf(2)
state = State(block, real=false)  # complex State
state = random_state(block, seed=1234)
display(vector(state))

state = random_state(block, seed=4321)
display(vector(state))

state = random_state(block, seed=4321)
display(vector(state))