【模板】伪随机数生成器
#include<bits/stdc++.h>
using namespace std;
#define random(a,b) ((a)+Curl_rand()%((b)-(a)+1))
static unsigned int randseed;
int n,cnt;
unsigned int Curl_rand(void)
{
unsigned int r;
/* 返回一个无符号32位整型的伪随机数. */
r = randseed = randseed * 1103515245 + 12345;
return (r << 16) | ((r >> 16) & 0xFFFF);
}
void Curl_srand(void)
{
/* 产生随机的伪随机数序列。 */
randseed = (unsigned int) time(NULL);
Curl_rand();
Curl_rand();
Curl_rand();
}
int main() {
Curl_srand();
}