   Another Method for Random Number Generation
  I''m playing with mutexes, cause i have to implement some thread security in my engine.To test mutexes i created a simple function get_number that increments a static UINT variable and returns its current result.Then I created 5 threads. Each one of these fills in a 100.000 array of UINTs with numbers they get from get_number.Of course 5 concurrent threads querying the function at the same time mess things up. I allways got a diferent result, and its quite fast if you want a method to create random numbers or seed a random number generator (a bit unorthodox method i know).Then i implemented the mutex and the Wait call to block.Now the sum of all arrays was equal every single time, and the whole thing was a good 4 seconds slower...Just throwing this out there, never know if someone might have a use for it...   [Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD]    [Yann  L.][Enginuity]  [Penny Arcade]  [MSDN][VS  RoadMap][Humus][BSPs][UGP][NeHe]"I say we take off and nuke the entire site from orbit. It''s the only way to be sure." 
  It''s a neat idea.  I''d argue that it''s not guaranteed to behave in certain mathematically desireable ways.  But, if you have multiple threads each calling rand on separate seed spaces, and buffering those calls in time sequence, it might make for a bit more nondeterminism.  I''m not certain it''d be any ''better'' than rand though.   I like pie. 