实测手动实现 1e7 范围比内置快 3 倍左右
unsigned int SEED = 17;
inline int Rand(){
SEED=SEED*1103515245+12345;
return (SEED/65536)%666;
}
PS xjb 乱敲也是可以的
#include<stdio.h>
unsigned int xjb=2333333;
int Rand(){
return (xjb=xjb*12345+23333)%7;
}
int arr[33],cnt,i;
int main(){
while(cnt++<233333333) arr[Rand()]++;
for(i=1;i<=6;i++) printf("%d\n",arr[i]);
return 0;
}