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
[no squash] Unittest and some documentation things #14238
Conversation
152c9d9
to
aabf974
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first comments
f28f7a6
to
eb5ecab
Compare
607d892
to
1829160
Compare
{ | ||
m_next = seed; | ||
} | ||
|
||
inline int next() | ||
inline u32 next() | ||
{ | ||
m_next = m_next * 1103515245 + 12345; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR to fix, but isn't there some integer overflow UB here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered about that too and signed overflow is indeed UB.
Converting it to unsigned (while keeping compatibility with the negative seeds) would be a bother...
@@ -70,14 +70,14 @@ class PseudoRandom { | |||
PcgRandom, we cannot modify this RNG's range as it would change the | |||
output of this RNG for reverse compatibility. | |||
*/ | |||
if ((u32)(max - min) > (RANDOM_RANGE + 1) / 10) | |||
if ((u32)(max - min) > (RANDOM_RANGE + 1) / 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the 10 become 5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see commit msg
@@ -8057,7 +8057,9 @@ A 32-bit pseudorandom number generator. | |||
Uses PCG32, an algorithm of the permuted congruential generator family, | |||
offering very strong randomness. | |||
|
|||
It can be created via `PcgRandom(seed)` or `PcgRandom(seed, sequence)`. | |||
* constructor `PcgRandom(seed, [seq])` | |||
* `seed`: 64-bit unsigned seed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not this PR's job to fix, but this is fishy since on the Lua side of things, we can only represent integers up to 2^53 accurately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷
The path being tested for is in the default search path for games, so it would still pass if the env var was not working.
Also extends the allowed range on the C++ side. This has no side-effects.
I think it's better suited here than in the wiki.
notable thing: you can now properly run unit tests from an installed MT build because it no longer tries to read from
/home/you/where/ever/the/source/was
(when it isn't anymore).it will still skip some if you don't have devtest however.