jeudi 12 décembre 2019

In Python, How to put constraits on four random numbers making two negative and two positive and equating to 0?

How do i make two random negative numbers and two positive random numbers equal zero.For example,

array([-.5,-.25,.25,.50]) = 0. [-.33,.232,-.232,.33] = 0.

The number are constrained between -1 and 1. Size is 4 with 2 neg,2 pos.

equate_to_zero = np.random.rand(4)

equate_to_zero = np.random.randint(-1,1,4)



Aucun commentaire:

Enregistrer un commentaire