jeudi 14 octobre 2021

Python:: assign random values but should include specific number

I know how to create an array includes random values, but I would like to have at least one number equal to specific value, and all random values should be greater than 1 ?

import numpy as np
x=np.random.rand(1,4)
specif_value=3
print(x)
#x=[2 3 1 1]



Aucun commentaire:

Enregistrer un commentaire