guanwencan's picture
Upload 6 files
483c6e9 verified
Raw History Blame Contribute Delete
312 Bytes
import numpy as np
R_OUTER = 3.45
def sample(x, y, n=3200, seed=0, alpha=3.0, base=0.15):
r = np.hypot(x, y)
rho = R_OUTER / np.maximum(r, R_OUTER)
w = base + rho ** alpha
w = w / w.sum()
rng = np.random.default_rng(seed)
return np.sort(rng.choice(len(x), size=n, replace=False, p=w))