Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
priyakasimbeg committed Feb 6, 2024
1 parent e4476aa commit 9ebdca7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions algorithmic_efficiency/random_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _signed_to_unsigned(seed: SeedType) -> SeedType:
def _fold_in(seed: SeedType, data: int) -> SeedType:
rng_1 = np.random.RandomState(seed=_signed_to_unsigned(seed))
new_seed_1 = rng_1.randint(MIN_INT32, MAX_INT32, dtype=np.int32)
# Truncate data to 32-bits, since numpy does not support 64-bit ints.
rng_2 = np.random.RandomState(seed=_signed_to_unsigned(data) & 0xffffffff)
new_seed_2 = rng_2.randint(MIN_INT32, MAX_INT32, dtype=np.int32)
return new_seed_1 + new_seed_2
Expand Down

0 comments on commit 9ebdca7

Please sign in to comment.