00001 00008 #include "dkcMath.h" 00009 #include <limits.h> 00010 00011 void WINAPI dkcSrand(ULONG *seed,ULONG num) 00012 { 00013 *seed = num; 00014 } 00015 00016 int WINAPI dkcRand(ULONG *seed) 00017 { 00018 (*seed) = (*seed) * 1103515245L + 12345; 00019 return (unsigned)((*seed) / 65536L) % 32768U; 00020 } 00021 00022 int WINAPI dkcRandom(ULONG *seed,ULONG Max_) 00023 { 00024 return dkcRand(seed) * (Max_ ) / SHRT_MAX; 00025 } 00026 00027