/* r_drive0.c---测试rand0()函数 */#define_CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdbool.h>#include<stdlib.h>externunsignedintrand0(void);intmain(void){
int count;for(count =0; count <5; count++){
printf("%d\n",rand0());}return0;}
/* rand0.c --生成随机数*/staticunsignedlongint next =1;/* 种子 */unsignedintrand0(void){
/* 生成伪随机数的魔术公式 */
next = next *1103515245+12345;return(unsignedint)(next /65536)%32768;}
/* r_drive1.c */#define_CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdbool.h>#include<stdlib.h>externintrand1(void);externvoidsrand1(unsignedint x);intmain(void){
int count;unsigned seed;printf("Please enter your choice for seed.\n");