/*1.从同一个种子开始*/
#include stdio.h
#include conio.h
static unsigned long int next=1;int rand0(void)
{
next=next*1103515245+12345;
return (unsigned int)(next/65536)%32768;
}int main(void)
{
int count;for(count=0;count5;count++)
printf("%hd",rand0());
getch();
return 0;
}/*2.重置种子*/
#include stdio.h
#include conio.h
static unsigned long int next=1;int rand1(void)
{
next=next*1103515245+12345;
return (unsigned int)(next/65536)%32768;
}void srand1(uns...[ 查看全文 ]