一点一滴成长

导航

2018年3月28日 #

生成随机数

摘要: C语言中生成随机数的方法: #include <time.h> #include <stdlib.h> int main() { srand(time(NULL)); //为rand函数提供种子 printf("%d\n", rand() % 10); //输出一个随机数,范围为0-9 printf 阅读全文

posted @ 2018-03-28 18:00 整鬼专家 阅读(2285) 评论(0) 推荐(0)