随机数据生成

Code:

#include<cstdio>
#include<algorithm>
#include<ctime>
#include<cstdlib>
using namespace std;
const int maxn = 2000;
int arr[maxn];
int random(int n){ return (long long) rand() * rand() % n; }     //生成一个 0 ~ n 的随机数
int main()
{
    srand((unsigned) time(0));                                   //随机数种子
}

  

原文地址:https://www.cnblogs.com/guangheli/p/9845137.html