Skip to content

Fix unreachable scalar fast-path in RandomState.uniform - #167

Merged
vlad-perevezentsev merged 6 commits into
masterfrom
fix_uniform_return
Sep 1, 2026
Merged

Fix unreachable scalar fast-path in RandomState.uniform#167
vlad-perevezentsev merged 6 commits into
masterfrom
fix_uniform_return

Conversation

@vlad-perevezentsev

Copy link
Copy Markdown
Collaborator

This PR fixes a scalar fast-path in RandomState.uniform that was never reached.
The vec_cont2_array_sc(...) call was wrongly indented inside the if flow >= fhigh block, so scalar bounds fell through to the array path and returned 0-d ndarray instead of a Python float

import mkl_random

# Before
mkl_random.uniform(0.0, 1.0)
# array(0.13436424)

# Now
mkl_random.uniform(0.0, 1.0)
# 0.13436424476094544

@antonwolfy antonwolfy added this to the 1.6.0 release milestone Aug 31, 2026
Comment thread CHANGELOG.md Outdated
Comment thread mkl_random/tests/test_random.py Outdated
Comment thread mkl_random/mklrand.pyx Outdated

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlad-perevezentsev
vlad-perevezentsev merged commit 6e2eed0 into master Sep 1, 2026
119 of 127 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.

2 participants