关于我自己个人对随机值的一些了解,以及水分(RP++)模板
srand(unsigned(time(NULL))); 根据当前时间生成随机种子
rand() 根据种子生成值
1 2 3 4 5 6 7 8 9
| #include <time.h> #include <stdio.h> #include <stdlib.h> #define re register
int main() { srand(unsigned(time(NULL))); rand()%2?puts("Yes"):puts("No"); }
|