Skip to content

Commit

Permalink
[FIX] Numba 0.57 compatibility (#151)
Browse files Browse the repository at this point in the history
* DEPS: update numba to 0.57

* FIX: fix function signature for randint to be compatible with numba 0.57

* FIX: remove redundant check and test

* bump version for 1.1.5

fixes numba 0.57 incompatibility
  • Loading branch information
rishi-kulkarni authored May 24, 2023
1 parent 7bd4994 commit b4cf64f
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 277 deletions.
9 changes: 3 additions & 6 deletions hierarch/internal_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def set_numba_random_state(seed: int):
seed : int32
Seed for Numba's internal MT PRNG.
"""
if type(seed) is nb.int64:
np.random.seed(seed)
else:
raise ValueError("Numba seed must be an integer.")
np.random.seed(seed)


@nb.jit(nopython=True, cache=True)
Expand Down Expand Up @@ -175,7 +172,7 @@ def bounded_uint(ub):
-------
int
"""
x = np.random.randint(low=2**32)
x = np.random.randint(low=0, high=2**32)
m = ub * x
lower = np.uint32(m)
if lower < ub:
Expand All @@ -185,7 +182,7 @@ def bounded_uint(ub):
if t >= ub:
t %= ub
while lower < t:
x = np.random.randint(low=2**32)
x = np.random.randint(low=0, high=2**32)
m = ub * x
lower = np.uint32(m)
return m >> 32
Expand Down
Loading

0 comments on commit b4cf64f

Please sign in to comment.