- fixed v_to_ph parameter consideration

- matrix: use different random implementations
This commit is contained in:
2025-12-18 15:49:18 +01:00
parent 855c392970
commit 3b68b9ad79
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -1,13 +1,13 @@
import numpy as np
import time
rng = np.random.default_rng(int(time.monotonic()))
np.random.seed(int(time.monotonic()))
def uniform(shape: tuple, mu: float = 0.5, std: float = 1.0) -> np.ndarray:
return std * (rng.uniform(size=shape) + mu - 0.5)
return std * (np.random.rand(shape[0], shape[1]) + mu - 0.5)
def gaussian(shape: tuple, mu: float = 0.5, std: float = 1.0) -> np.ndarray:
return rng.normal(size=shape, loc=mu, scale=std)
def gaussian(shape: tuple, mu: float = 0.0, std: float = 1.0) -> np.ndarray:
return std * (np.random.randn(shape[0], shape[1]) + mu)
def sample(src: np.ndarray) -> np.ndarray:
return (src > uniform(src.shape)).astype(float)