获得随机数
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main()
{
int posX,posY;
srand((unsigned)time(NULL));
for(int i = 0 ; i < 9; i++)//通过循环得到size个不同的随机数对
{
posX = (rand()%9) ;
posY = (rand()%9);
cout << posX << " " << posY <<endl;
}
return 0;
}
浙公网安备 33010602011771号