We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bb7a566 + 5c4485e commit 44655ccCopy full SHA for 44655cc
algorithmic_efficiency/random_utils.py
@@ -26,11 +26,11 @@
26
27
def _signed_to_unsigned(seed: SeedType) -> SeedType:
28
if isinstance(seed, int):
29
- return seed + 2**32 if seed < 0 else seed
+ return seed % 2**32
30
if isinstance(seed, list):
31
- return [s + 2**32 if s < 0 else s for s in seed]
+ return [s % 2**32 for s in seed]
32
if isinstance(seed, np.ndarray):
33
- return np.array([s + 2**32 if s < 0 else s for s in seed.tolist()])
+ return np.array([s % 2**32 for s in seed.tolist()])
34
35
36
def _fold_in(seed: SeedType, data: Any) -> List[Union[SeedType, Any]]:
0 commit comments