random2
Python 3 compatible Python 2 `random` Module.
Decision gist · record as of 2026-08-14
Yes, if you are porting Python 2 code to Python 3 and need deterministic random sequences to remain stable. No, if you are writing new Python 3 code—use the native random module instead. The package is dormant but stable, carries no known vulnerabilities, and has minimal friction. It solves a narrow, real problem for legacy code migration.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10, 3.11, 3.12, or 3.13; earlier Python 3 versions are not supported by version 1.0.2.
- Low install friction with no runtime dependencies.
- Dormant maintenance status (970 days since last release) but marked Production/Stable and updated to support Python 3.10, 3.11, 3.12, and 3.13 as of 2023-12-18.
License · maintenance · safety
Python 2.1.1 (permissive) — Licensed under Python Software Foundation License (permissive), imposing no significant restrictions on use or redistribution.
last release 2023-12-18 (970 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 171,150 downloads/mo, #10,379 on PyPI
Alternatives
Verify before relying
pip install random2
import random2
random2.seed(0)
print(random2.randint(1, 10))- Whether the Python 2.7 random algorithm implementation is mathematically identical to the original or only functionally equivalent for typical use cases.
- Performance characteristics compared to Python 3's native random module.
- Specific numeric output examples to verify seed reproducibility across Python versions.
What it is and what it does
Random2 is a backport of Python 2.7's random module to Python 3. It exists to solve a specific compatibility problem: Python 3 changed the implementation of randrange(), so even with an identical seed, Python 2 and Python 3 produce different random sequences. This breaks reproducibility in test suites and other code that depends on stable, predictable random output across Python versions.
The package provides a drop-in replacement that generates the same sequence as Python 2.7 when given the same seed. It has no external dependencies and installs as a pure Python wheel. It is most useful for porting legacy test code or simulations from Python 2 to Python 3 without having to rewrite all the expected random outputs.
Use it for
- Porting Python 2 test suites to Python 3 while keeping random-number expectations unchanged.
- Running stochastic simulations or Monte Carlo code that was originally written for Python 2 and requires identical results.
- Comparing random-number behavior between Python 2 and Python 3 implementations of the same algorithm.
- Reproducing historical results from Python 2 code that relied on specific random sequences.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are porting Python 2 code to Python 3 and need deterministic random sequences to remain stable.
No, if you are writing new Python 3 code—use the native random module instead. The package is dormant but stable, carries no known vulnerabilities, and has minimal friction. It solves a narrow, real problem for legacy code migration.
Install
random2 on PyPI
Before you install
Low install friction with no runtime dependencies. Dormant maintenance status (970 days since last release) but marked Production/Stable and updated to support Python 3.10, 3.11, 3.12, and 3.13 as of 2023-12-18.
Requires Python 3.10, 3.11, 3.12, or 3.13; earlier Python 3 versions are not supported by version 1.0.2.
License in practice
Licensed under Python Software Foundation License (permissive), imposing no significant restrictions on use or redistribution.
Quickstart
pip install random2
import random2
random2.seed(0)
print(random2.randint(1, 10))
Verify before relying
- Whether the Python 2.7 random algorithm implementation is mathematically identical to the original or only functionally equivalent for typical use cases.
- Performance characteristics compared to Python 3's native random module.
- Specific numeric output examples to verify seed reproducibility across Python versions.
Package facts
| License | Python 2.1.1 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 970 days since the last release |
| First released | |
| Downloads | 171,150 / month, #10,379 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Python Software Foundation LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: Implementation :: CPython |
Evidence: random2-1.0.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python 2 random module python 3”
- random2Provides Python 2.7's random module implementation for Python 3,…
- rstrGenerates random strings from custom alphabets, predefined character…
- exrexExrex generates all or random strings matching a given regular…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also pytest-rng · random-slugs · pytest-randomly · pytorch-seed · haikunator · pytest-random-order · backports.csv · random-address · dict-hash · pyudorandom