如题

解决方案 »

  1.   

    srand(GetTickCount());//初始化发生器
    int n=rand();//得到一个随机数
      

  2.   

    srand(GetTickCount());//初始化发生器
    int n=rand();//得到一个随机数接上面
    然后将随机数取256的模,余数就是随机数。
      

  3.   

    int temp,//临时变量
    srand( (unsigned)time( NULL ) );
           temp=rand(); 
           temp=temp%36+1; //得到一个1-36的数
      

  4.   

    CTime t = CTime:: GetCurrentTime();
    (rand() + t.GetSecond())% 100000000