Suppose X is a matrix. The following commands generate a matrix with the shape of X in randomly selected the members between 0 and 1 (80% of the members are 1 and the rest 0).
srng = RandomStreams()
srng.binomial(X.shape, p=0.8)
The question is how to make the similar random matrix between 1 and another number likes 2.5. In another word, I need a matrix with the shape of X in randomly selected the members between 1 and 2.5 (80% of the members are 1 and the rest 2.5)
Aucun commentaire:
Enregistrer un commentaire