Skip to content

[codex] Fix JAX randint backend#1849

Merged
FlorianPfaff merged 2 commits intomainfrom
codex/fix-jax-randint
Apr 25, 2026
Merged

[codex] Fix JAX randint backend#1849
FlorianPfaff merged 2 commits intomainfrom
codex/fix-jax-randint

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

Summary

Fix the JAX random backend so random.randint delegates to jax.random.randint instead of jax.random.uniform.

This keeps the function name and backend contract aligned: JAX now returns integer samples for integer random draws, matching the behavior expected from the NumPy/autograd and PyTorch backends.

Root Cause

The JAX _randint helper split the PRNG key correctly, but then called jax.random.uniform, so callers got floating-point samples from random.randint.

Tests

Added tests/test_backend_random.py to check that random.randint returns integer samples with the requested shape and bounds under each backend's existing call signature.

Not run locally because this Codex workspace is read-only and the change was applied through the GitHub connector. The repository's PR CI should run the numpy, pytorch, and jax backend matrix.

@github-actions
Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 11.86s
✅ JSON prettier 2 0 0 0 0.45s
✅ JSON v8r 2 0 0 2.76s
✅ MARKDOWN markdownlint 2 0 0 0 0.69s
✅ MARKDOWN markdown-table-formatter 2 0 0 0 0.24s
✅ PYTHON bandit 383 0 0 5.48s
✅ PYTHON black 383 1 0 0 7.62s
✅ PYTHON flake8 383 0 0 2.95s
✅ PYTHON isort 383 1 0 0 0.72s
✅ PYTHON mypy 383 0 0 4.97s
✅ PYTHON pylint 383 0 0 112.72s
✅ PYTHON ruff 383 1 0 0 0.07s
✅ REPOSITORY checkov yes no no 22.61s
✅ REPOSITORY gitleaks yes no no 7.4s
✅ REPOSITORY git_diff yes no no 0.19s
✅ REPOSITORY secretlint yes no no 6.92s
✅ REPOSITORY syft yes no no 4.72s
✅ REPOSITORY trivy-sbom yes no no 1.98s
✅ REPOSITORY trufflehog yes no no 18.77s
✅ YAML prettier 4 0 0 0 0.45s
✅ YAML v8r 4 0 0 4.57s
✅ YAML yamllint 4 0 0 0.37s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff FlorianPfaff marked this pull request as ready for review April 25, 2026 08:33
@github-actions
Copy link
Copy Markdown
Contributor

Test Results

    12 files  ± 0      12 suites  ±0   4h 55m 35s ⏱️ + 8m 35s
 1 091 tests + 1   1 091 ✅ + 1      0 💤 ±0  0 ❌ ±0 
13 376 runs  +12  10 284 ✅ +12  3 092 💤 ±0  0 ❌ ±0 

Results for commit 083ce16. ± Comparison against base commit f344bab.

@FlorianPfaff FlorianPfaff merged commit 6f38abc into main Apr 25, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant