Given a numpy array
import numpy as np from numpy.random import random N = 5 x = random(N)
How to randomly multiply a subset of (some of the elements in) x by -1 in order to change the sign of some of the elements in the array?
x
-1
Aucun commentaire:
Enregistrer un commentaire