Changeset 247 for cpp/common/random.h


Ignore:
Timestamp:
11/07/14 17:51:01 (9 years ago)
Author:
Maciej Komosinski
Message:

Sources support both 32-bit and 64-bit, and more compilers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/random.h

    r197 r247  
    1212 #include <sys/stat.h>
    1313 #include <fcntl.h>
     14#endif
     15#ifdef __BORLANDC__
     16 #include <stdint.h> //uintptr_t in borland
    1417#endif
    1518#ifdef _WIN32
     
    7679                {
    7780                        counter++;
    78                         seed = time(NULL);              //time (seconds); could use hi-res timer but then we would depend on common/timer.h
    79                         seed ^= counter;                //incremented value, possibly randomly initialized
    80                         seed ^= (unsigned int)&counter; //memory address
     81                        seed = time(NULL);                         //time (seconds); could use hi-res timer but then we would depend on common/timer.h
     82                        seed ^= counter;                           //incremented value, possibly randomly initialized
     83                        seed ^= (unsigned int)(uintptr_t)&counter; //memory address
    8184                }
    8285#ifdef _WIN32 //add more randomness from uuid
Note: See TracChangeset for help on using the changeset viewer.