Changeset 77260 in webkit
- Timestamp:
- Feb 1, 2011 10:50:17 AM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r77248 r77260 1 2011-02-01 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Antonio Gomes. 4 5 Modify RandomNumberSeed.h to use USE(MERSENNE_TWISTER_19937) 6 https://bugs.webkit.org/show_bug.cgi?id=53506 7 8 Currently, use of the Mersenne Twister pseudorandom number generator 9 is hardcoded to the Windows CE port. With the passing of bug #53253, 10 we can generalize support for this PRNG to all ports that use srand(3) 11 and rand(3), including Windows CE. 12 13 * wtf/RandomNumberSeed.h: 14 (WTF::initializeRandomNumberGenerator): 15 1 16 2011-02-01 Dave Tapuska <dtapuska@rim.com> 2 17 -
trunk/Source/JavaScriptCore/wtf/RandomNumberSeed.h
r73177 r77260 39 39 #endif 40 40 41 #if OS(WINCE)41 #if USE(MERSENNE_TWISTER_19937) 42 42 extern "C" { 43 43 void init_by_array(unsigned long init_key[],int key_length); … … 55 55 // initialize rand() 56 56 srand(GetTickCount()); 57 58 // use rand() to initialize the real RNG59 unsigned long initializationBuffer[4];60 initializationBuffer[0] = (rand() << 16) | rand();61 initializationBuffer[1] = (rand() << 16) | rand();62 initializationBuffer[2] = (rand() << 16) | rand();63 initializationBuffer[3] = (rand() << 16) | rand();64 init_by_array(initializationBuffer, 4);65 57 #elif COMPILER(MSVC) && defined(_CRT_RAND_S) 66 58 // On Windows we use rand_s which initialises itself … … 75 67 srand(static_cast<unsigned>(time(0))); 76 68 #endif 69 70 #if USE(MERSENNE_TWISTER_19937) 71 // use rand() to initialize the Mersenne Twister random number generator. 72 unsigned long initializationBuffer[4]; 73 initializationBuffer[0] = (rand() << 16) | rand(); 74 initializationBuffer[1] = (rand() << 16) | rand(); 75 initializationBuffer[2] = (rand() << 16) | rand(); 76 initializationBuffer[3] = (rand() << 16) | rand(); 77 init_by_array(initializationBuffer, 4); 78 #endif 77 79 } 78 80
Note: See TracChangeset
for help on using the changeset viewer.