Hi there,
I am sincerely sorry for posting information that turned out wrong. I am very relieved that the PRNG works as intended - with a full-flavour-period of 2^32 seeds.
Since I read your post, I've been constantly thinking about where the problem might be since - even ready to blame some 32-bit-64-bit-conversion stuff - and decided to do a quick "reality check" on the code before I go to sleep.
And I found the flaw rather quickly:
uint32_t prng(uint32_t alterwert){
return (0x41C64E6D * alterwert+ 0x6073) % 0xFFFFFFFF;
}
/*
* "alterwert" is german for "old value".
* I'm a bad programmer and often switch languages in my source
*/
I'm really ashamed of having this fault in my sourcecode - even more because I laughed at some sources for doing the same mistake. Bulbapedia has it right, pokesav/projectpokemon has it wrong (twice).
Fixed it (hopefully) and started the next run. Should be able to cross-compare with emulator-output after sleep&work.
again, sorry for having made that stupid mistake and posting wrong information,
TCC
PS:
@mingot: you make it sound as if "brute force" was a bad way to try this experiment. I don't believe that there's any better way.
If you want to be really sure that prng visits every seed (apart from proving it theoretically), I can't see any other way than running it 2^32 cycles and watch.
I am sincerely sorry for posting information that turned out wrong. I am very relieved that the PRNG works as intended - with a full-flavour-period of 2^32 seeds.
Since I read your post, I've been constantly thinking about where the problem might be since - even ready to blame some 32-bit-64-bit-conversion stuff - and decided to do a quick "reality check" on the code before I go to sleep.
And I found the flaw rather quickly:
uint32_t prng(uint32_t alterwert){
return (0x41C64E6D * alterwert+ 0x6073) % 0xFFFFFFFF;
}
/*
* "alterwert" is german for "old value".
* I'm a bad programmer and often switch languages in my source
*/
I'm really ashamed of having this fault in my sourcecode - even more because I laughed at some sources for doing the same mistake. Bulbapedia has it right, pokesav/projectpokemon has it wrong (twice).
Fixed it (hopefully) and started the next run. Should be able to cross-compare with emulator-output after sleep&work.
again, sorry for having made that stupid mistake and posting wrong information,
TCC
PS:
@mingot: you make it sound as if "brute force" was a bad way to try this experiment. I don't believe that there's any better way.
If you want to be really sure that prng visits every seed (apart from proving it theoretically), I can't see any other way than running it 2^32 cycles and watch.