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

std/random produces different results on c/js[node] with int32 #23915

Closed
enthus1ast opened this issue Aug 2, 2024 · 0 comments · Fixed by #24003
Closed

std/random produces different results on c/js[node] with int32 #23915

enthus1ast opened this issue Aug 2, 2024 · 0 comments · Fixed by #24003
Assignees

Comments

@enthus1ast
Copy link
Contributor

enthus1ast commented Aug 2, 2024

Description

std/random produces different results on c/js[node] with int32.
I understand that it would not work with int64 but with int32 it should produce the same in my opinion

import std/random

randomize(123'i32)
echo rand(int32.high)

# Generates different results on c/js[node]
# C:       1187002471
# CPP:     1187002471
# js node:  822997781

Nim Version

$ nim --version
Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-07-03
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3b
active boot switches: -d:release

Current Output

# C:       1187002471
# CPP:     1187002471
# js node:  822997781

Expected Output

# C:       1187002471
# CPP:     1187002471
# js node: 1187002471

Possible Solution

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants