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
PseudoRandom always generating same sequence with big seed #3237
Comments
Yeah, internally all of the old random/noise functions internally use a 32 bit number as a seed. Unfortunately, "fixing" this would break compatibility with all old maps. That's the primary reason why it hasn't been done yet. I suppose this could be "solved" by making a note of it in some documentation. |
Not really sure why a larger integer makes it "not usable" with PseudoRandom. |
If the higher bit were really ignored, then there would be no problem. Look at the sequences I pasted at the end of this text. As you can see, all numbers that are >= 2147483648 are generating the same sequence, meaning that the higher bit is not being ignored. If that was the case, then 2147483649 would have to give the same sequence as 1, 2147483650 the same as 2 and etc. I said it's not usable because lots and lots of block seeds will end up giving the same numbers an generating the same things. I agree with you that one solution would be to simply add this to the documentation, so the modders will know they can use something like: But another solution would be just to make it ignore the higher bits.
|
The problem lies here. The return value of For example, the x86 instructions Behaviour on other architectures or with different compilers may be different. |
Considering that this behavior is compiler and architecture dependant, maps can currently be considered broken -- and a change that simply drops the top bits could be accepted as a fix for map compatability I think. It may be technically incompatible, but this only affects Lua mapgens, so it shouldn't be too much of an issue. |
When seed is >= 2^31, PseudoRandom is always generating the same sequence. This could be a bug to be fixed or a feature, I don't know (or maybe a bug that will not be fixed).
If it's not a thing to be fixed, I think there are 2 problems:
(I have tested both in 0.4.13 and compiling the latest version from git)
The text was updated successfully, but these errors were encountered: