int seed; void srand(int s) { seed = s; } int rand() { seed = seed * 22695477 + 1; return (seed>>16)&0x7fff; } 以上是C标准库函数的源码,int是32位的,8位机编译器,需修改为long, 22695477也没加上UL 保证和你在vc++6.0,turboc++3.0什么里的编译出来运行的结果相同 |
欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/) | Powered by Discuz! X3.4 |