GameMaker [Solved] Mersenne Twister output to 0.0 to 1.0 range?

So for fun I set out to program a gml implementation of the 32bit mersenne twister, which was simple enough (though I haven't tested it yet). However, that's all well and good, bit now in want to take the output it generates and make it usable by converting to to the 0.0 to 1.0 range and I've hit a wall. Theres plenty of information out there about the twister itself, but not really anything about what to do with the output. The only thing I was able to find was something in the C related family regarding uniform real distribution, but I dont know what to do with that information. So I guess my question would be, how do I convert the mersenne twister output into a usable range? Just dividing by the max value doesn't quite work.
 

chamaeleon

Member
So for fun I set out to program a gml implementation of the 32bit mersenne twister, which was simple enough (though I haven't tested it yet). However, that's all well and good, bit now in want to take the output it generates and make it usable by converting to to the 0.0 to 1.0 range and I've hit a wall. Theres plenty of information out there about the twister itself, but not really anything about what to do with the output. The only thing I was able to find was something in the C related family regarding uniform real distribution, but I dont know what to do with that information. So I guess my question would be, how do I convert the mersenne twister output into a usable range? Just dividing by the max value doesn't quite work.
If the MT algorithm outputs values in the range 0 - 2^32-1, why wouldn't dividing by 2^32 or 2^32-1 work?
 
If the MT algorithm outputs values in the range 0 - 2^32-1, why wouldn't dividing by 2^32 or 2^32-1 work?
*Facepalm* This is, of course, absolutely correct. Without actually testing, I neglected to account for the fact that gamemaker hex is just numbers, not actual binary data, and dividing would work just fine. I can't verify that my implementation of the twister is 100% accurate, but through testing, it appears to generate evenly distributed random numbers, so I'll call it a success.
 
Top