Changeset 49056 in webkit for trunk/JavaScriptCore/wtf/RandomNumber.cpp
- Timestamp:
- Oct 2, 2009, 4:35:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/RandomNumber.cpp
r45865 r49056 83 83 #elif PLATFORM(WINCE) 84 84 return genrand_res53(); 85 #elif PLATFORM(WIN_OS) 86 uint32_t part1 = rand() & (RAND_MAX - 1); 87 uint32_t part2 = rand() & (RAND_MAX - 1); 88 uint32_t part3 = rand() & (RAND_MAX - 1); 89 uint32_t part4 = rand() & (RAND_MAX - 1); 90 // rand only provides 15 bits on Win32 91 uint64_t fullRandom = part1; 92 fullRandom <<= 15; 93 fullRandom |= part2; 94 fullRandom <<= 15; 95 fullRandom |= part3; 96 fullRandom <<= 15; 97 fullRandom |= part4; 98 99 // Mask off the low 53bits 100 fullRandom &= (1LL << 53) - 1; 101 return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53); 85 102 #else 86 103 uint32_t part1 = rand() & (RAND_MAX - 1);
Note:
See TracChangeset
for help on using the changeset viewer.