pykoop.random_state
- random_state(low, high, rng=None)
Generate a random initial state.
Generates uniform random data between specified bounds.
Very simply wrapper. Really only exists to keep a common interface with random_input, which is much more complex.
- Parameters:
- Returns:
Random initial state.
- Return type:
np.ndarray
Examples
Simulate a mass-spring-damper with random initial condition
>>> x_max = np.array([1, 1]) >>> x0 = pykoop.random_state(-x_max, x_max) >>> t, x = msd.simulate((0, 1), 1e-3, x0, lambda t: 0)