I want to generate random numbers in the range -1, 1
and want each one to have equal probability of being generated. I.e. I don\'t want the extremes to be less
From the documentation for numpy.random.random_sample:
Results are from the “continuous uniform” distribution over the stated interval. To sample Unif[A, b), b > a multiply the output of random_sample by
(b-a)
and adda
:(b - a) * random_sample() + a
Per Sven Marnach's answer, the documentation probably needs updating to reference numpy.random.uniform.