?? rand.h
字號:
#define RANDOM_MAX 0x7FFFFFFFstatic long my_do_rand(unsigned long *value){/* */ long quotient, remainder, t; quotient = *value / 127773L; remainder = *value % 127773L; t = 16807L * remainder - 2836L * quotient; if (t <= 0) t += 0x7FFFFFFFL; return ((*value = t) % ((unsigned long)RANDOM_MAX + 1));}static unsigned long next = 1;int my_rand(void){ return my_do_rand(&next);}void my_srand(unsigned int seed){ next = seed;}#include <time.h>int main(){ int i; my_srand((unsigned)(time(NULL))); for(i=0;i<100;i++) { if(i % 10 == 0) printf("\n"); printf("%d\t",my_rand()); } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -