0.45519596 0.94176289 0.14892619 0.9395088 0.5045557 Original array Replace 0.45519596 -1. 0.14892619 0.9395088 0.5045557 0.45519596 0.94176289 0.94176289 0.14892619 0.9395088 0.5045557 Maximum value Replaced by -1 np.random.random(5) x[x.argmax()] = -1