转自:windows下srand48()和drand48()的问题
#ifndef DRAND48_H
#define DRAND48_H #include <stdlib.h> #define m 0x100000000LL
#define c 0xB16
#define a 0x5DEECE66DLL static unsigned long long seed = ; double drand48(void)
{
seed = (a * seed + c) & 0xFFFFFFFFFFFFLL;
unsigned int x = seed >> ;
return ((double)x / (double)m); } void srand48(unsigned int i)
{
seed = (((long long int)i) << ) | rand();
} #endif