random2 is a Python library that provides a Python 3 compatible implementation of the Python 2 `random` module. Its primary purpose is to assist in migrating Python 2 code to Python 3 by preserving the exact behavior and algorithms of the older `random` module, particularly for applications requiring reproducible results from Python 2 seeds. The current version is 1.0.2, and the library appears to be unmaintained since 2017.
pip install random2Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic usage of `random2` including seeding, generating random numbers, choices, and sampling, showcasing state preservation typical for Python 2 compatibility.
For standard Python 3 randomness, always prefer the built-in `random` module (`import random`).
If migrating Python 2 code, carefully test to ensure reproducibility is maintained. If new to Python 3, understand that `random2` is not a drop-in replacement for `random` without considering behavioral differences.
Consider re-evaluating if strict Python 2 `random` compatibility is still critical. If not, refactor your codebase to use Python 3's native `random` module or an actively maintained alternative.
Run `pip install random2` in your terminal.
If you need `SystemRandom`, you must use the built-in Python 3 `random` module: `import random; sys_random = random.SystemRandom()`.
Ensure you are explicitly importing and using `random2` (e.g., `import random2; random2.seed(...)`) if you require strict Python 2 `random` behavior for reproducibility in Python 3. Otherwise, adapt your tests and expectations for Python 3's native `random` module.
No dependency data recorded yet.