示例#1
0
 def _random_benchmark(self,
                       random_state: np.random.Generator) -> Benchmark:
     seed = random_state.integers(UINT_MAX)
     return self.benchmark_from_seed(seed)
示例#2
0
def fixture_x0(rng: np.random.Generator, x0_shape: ShapeType) -> np.ndarray:
    """Random data from a standard normal distribution."""
    return rng.normal(0, 1, size=x0_shape)
def _sample_truncated_integer_gaussian(rng: np.random.Generator, loc: int, scale: int, min_val: int, max_val: int) -> int:
    sample = None
    while sample is None or not (min_val <= sample <= max_val):
        sample = int(rng.normal(loc=loc, scale=scale))
    return sample