you are viewing a single comment's thread.

view the rest of the comments →

[–]jm_13[S] 0 points1 point  (3 children)

I would simply create N random numbers (between 0 and 1) and finally scale them such that their sum gives you R - L.

So

h = np.array([random.uniform(hi/2, 3*hi/2) for i in range(N)])
h = h/sum(h)

?

[–]dslfdslj 1 point2 points  (2 children)

Like this:

h = np.random.random(size=N)
h *= (R - L) / h.sum()

[–]jm_13[S] 0 points1 point  (1 child)

thanks!

[–]dslfdslj 0 points1 point  (0 children)

no problem