We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Godot version: 3.2.3 & current master (ba51af7)
OS/device including version: not graphics-related.
Issue description:
RNG state is not restored after calling RandomNumberGenerator.set_seed with a seed saved from RandomNumberGenerator.get_seed.
RandomNumberGenerator.set_seed
RandomNumberGenerator.get_seed
The issue is caused by get_seed returning the current RNG state, while set_seed takes a seed, not state.
get_seed
set_seed
PR #35764 tries to resolve this problem by making the interface more intuitive, but seems inactive.
PR #27171 introduced this behavior.
A workaround is, maybe, reseeding manually after generating a number, sacrificing randomness.
Steps to reproduce:
Run the following script with Godot.
extends SceneTree func _init(): var rng = RandomNumberGenerator.new() # let the seed change rng.randomize() rng.randi() rng.randi() var saved = rng.seed print('Current seed: ', saved) print('This seed produces:') print(rng.randf()) print(rng.randf()) rng.seed = saved print('Resetting the seed produces:') print(rng.randf()) print(rng.randf())
Actual output:
Current seed: 8670679328791200068 This seed produces: 0.823806 0.514134 Resetting the seed produces: 0.028601 0.02974
Expected output:
Current seed: 8670679328791200068 This seed produces: 0.823806 0.514134 Resetting the seed produces: 0.823806 0.514134
Minimal reproduction project: N/A
The text was updated successfully, but these errors were encountered:
I thought that was reverted. b5d9099
Sorry, something went wrong.
It's only reverted on the 3.1 branch. 😂
Oh right, it was left in the master, and 3.2 was the master back then. Yeah, reverting it solves the issue.
Successfully merging a pull request may close this issue.
RandomNumberGenerator
Godot version: 3.2.3 & current master (ba51af7)
OS/device including version: not graphics-related.
Issue description:
RNG state is not restored after calling
RandomNumberGenerator.set_seed
with a seed saved fromRandomNumberGenerator.get_seed
.The issue is caused by
get_seed
returning the current RNG state, whileset_seed
takes a seed, not state.PR #35764 tries to resolve this problem by making the interface more intuitive, but seems inactive.
PR #27171 introduced this behavior.
A workaround is, maybe, reseeding manually after generating a number, sacrificing randomness.
Steps to reproduce:
Run the following script with Godot.
Actual output:
Expected output:
Minimal reproduction project: N/A
The text was updated successfully, but these errors were encountered: