Cxbx-Reloaded / xbox_kernel_test_suite

Xbox kernel APIs tester written using nxdk
GNU General Public License v3.0
22 stars 6 forks source link

test_RtlUpperString uses GetTickCount to select random letters #62

Closed ergo720 closed 4 years ago

ergo720 commented 4 years ago

Triggered by PR review

This is independent of this PR, but this is bad. The CPU runs at 733MHz, so 1.36425648 nanoseconds per cycle. GetTickCount is in milliseconds. So when this loop runs the value will probably be constant. It's also not giving consistent values when running the test multiple times. You should switch to a constant seed and a random function. pdclib implements srand and rand; it also implements rand_s but that can't be seeded, so it's not recommended here.