http://zhidao.baidu.com/question/688719686574659564.html
#include <iostream>
#include <time.h>
using namespace std;
double GetRand();
int main()
{
cout << GetRand() << endl;
return 0;
}
double GetRand()
{
srand(time(NULL));
int iRand = rand();
iRand %= 10000; // 取0 ~ 9999
return iRand / 10000.0; // 注意加".0"
// PS:保留几位小数就合适求舍,求商
}