We all know and love the numpy
function random.rand
, which "create[s] an array of the given shape and propagate[s] it with random samples from a uniform distribution over [0, 1)
":
>>> import numpy as np
>>> np.random.rand(3,2)
array([[ 0.14022471, 0.96360618], #random
[ 0.37601032, 0.25528411], #random
[ 0.49313049, 0.94909878]]) #random
What are my options if I want random samples from a uniform distribution over [0, 1]
? Note the subtle difference: The numpy
function excludes 1
; my desired function includes 1
.
Aucun commentaire:
Enregistrer un commentaire