I need a boolean or binary numpy array size (m,m) with n True values scattered randomly. I'm trying to make a random grid pattern. I will have a 5x5 array with 3 True values over it and will sample at those points only.
Using random.choice I sometimes get more or less than the 3 desired True values.
for x in range(0,25):
x = np.random.choice([True,False], p=[0.15,0.85])
Aucun commentaire:
Enregistrer un commentaire