Skip to content

Commit

Permalink
make randsphere with ranges work for default_rng
Browse files Browse the repository at this point in the history
np.random.RandomState would allow uniform with low > high but
not np.random.default_rng
  • Loading branch information
esheldon committed Oct 14, 2024
1 parent aee4704 commit 7873b09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions esutil/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,8 @@ def randsphere(num, ra_range=None, dec_range=None, system="eq", rng=None):
ra = rng.uniform(low=ra_range[0], high=ra_range[1], size=num)

# number [-1,1)
cosdec_min = cos(deg2rad(90.0 + dec_range[0]))
cosdec_max = cos(deg2rad(90.0 + dec_range[1]))
cosdec_min = cos(deg2rad(90.0 + dec_range[1]))
cosdec_max = cos(deg2rad(90.0 + dec_range[0]))

v = rng.uniform(low=cosdec_min, high=cosdec_max, size=num)

Expand Down

0 comments on commit 7873b09

Please sign in to comment.