Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand(Float32, n) generates two values of the same number over and over when n is < 16 #57336

Closed
KristofferC opened this issue Feb 10, 2025 · 5 comments · Fixed by #57338
Closed
Labels
randomness Random number generation and the Random stdlib
Milestone

Comments

@KristofferC
Copy link
Member

KristofferC commented Feb 10, 2025

julia> rand(Float32, 8)
8-element Vector{Float32}:
 0.20123601
 0.20123601
 0.20944309
 0.20944309
 0.22612727
 0.22612727
 0.67038965
 0.67038965
@KristofferC KristofferC added the randomness Random number generation and the Random stdlib label Feb 10, 2025
@KristofferC KristofferC added this to the 1.12 milestone Feb 10, 2025
@KristofferC KristofferC changed the title rand(Float32, 2, 2) always gives two identical columns rand(Float32, 2, 2) always gives two identical rows Feb 10, 2025
@AayushSabharwal

This comment has been minimized.

@KristofferC KristofferC changed the title rand(Float32, 2, 2) always gives two identical rows rand(Float32, 2, 2) always gives two identical columns in 1.12 Feb 10, 2025
@KristofferC

This comment has been minimized.

@AayushSabharwal

This comment has been minimized.

@KristofferC
Copy link
Member Author

Bisected to d09abe5, #56144, cc @giordano.

This should basically be a non-functional change

Famous last workds.

@KristofferC KristofferC changed the title rand(Float32, 2, 2) always gives two identical columns in 1.12 rand(Float32, n) generates two values of the same number over and over Feb 10, 2025
@KristofferC KristofferC changed the title rand(Float32, n) generates two values of the same number over and over rand(Float32, n) generates two values of the same number over and over when n is < 16 Feb 10, 2025
@giordano
Copy link
Contributor

giordano commented Feb 10, 2025

l = _uint2float(ui, Float32)
this line does look fishy. The rest of the change was good though 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
randomness Random number generation and the Random stdlib
Projects
None yet
3 participants