Let's say I have following C++ code for generation of the pseudo random numbers uniformly distributed in range <0;1> on 32 bits machine.
#include <cstdint>
float randomNumber() {
static uint32_t next = 1;
next = ((1103515245*next + 12345) % 4294967296);
return static_cast<float>(next)/4294967296;
}
How can I convincingly inspect whether the code works correctly or not?
Aucun commentaire:
Enregistrer un commentaire