生成随机数

#include <iostream>
#include <cstdio>
#include<time.h>

using namespace std;
int main()
{
srand((long)time(NULL));

for (size_t i = 0; i < 10; i++)
{
cout << rand() << endl;//如果限定范围则rand()% 范围
}
return 0; 
}

posted @ 2014-01-16 22:31  IT专业户  阅读(169)  评论(0编辑  收藏  举报