Skip to content

Commit

Permalink
Unit tests now pass
Browse files Browse the repository at this point in the history
  • Loading branch information
braxtoncuneo committed Aug 23, 2023
1 parent d28cb1b commit 283d65c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions mcdc/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def int_hash_combo(value,seed):

@njit
def rng_skip_ahead_(n, mcdc):
n = numba.uint64(n)
seed_base = mcdc["rng_seed_base"]
g = mcdc["setting"]["rng_g"]
c = mcdc["setting"]["rng_c"]
Expand All @@ -192,15 +193,15 @@ def rng_skip_ahead_(n, mcdc):

n = n & mod_mask
while n > 0:
if n & 1:
if n & numba.uint64(1):
g_new = g_new * g & mod_mask
c_new = (c_new * g + c) & mod_mask

c = (g + numba.uint64(1)) * c & mod_mask
g = g * g & mod_mask
n >>= 1
n >>= numba.uint64(1)

mcdc["rng_seed"] = (g_new * int(seed_base) + c_new) & mod_mask
mcdc["rng_seed"] = (g_new * seed_base + c_new) & mod_mask

@njit
def stateful_rng(state,mcdc):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import mcdc.card
from mcdc.constant import INF


def loop_setup_test():
type_.make_type_surface(1)
type_.make_type_particle(False,0)
P = np.zeros(1, dtype=type_.particle)[0]
S = np.zeros(1, dtype=type_.surface)[0]

Expand Down

0 comments on commit 283d65c

Please sign in to comment.