MCPcopy Create free account
hub / github.com/NetHack/NetHack / sys_random_seed

Function sys_random_seed

sys/share/pcmain.c:791–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789}
790
791unsigned long
792sys_random_seed(void)
793{
794 unsigned long seed = 0L;
795 unsigned long pid = (unsigned long) getpid();
796 boolean no_seed = TRUE;
797
798#ifdef AMIGA_STRONG_RANDOM_SEED_HERE
799 /* hypothetical - strong seed code is required */
800 /* then has_strong_seed could be set */
801#endif
802 if (no_seed) {
803 seed = (unsigned long) getnow(); /* time((TIME_type) 0) */
804 /* Quick dirty band-aid to prevent PRNG prediction */
805 if (pid) {
806 if (!(pid & 3L))
807 pid -= 1L;
808 seed *= pid;
809 }
810 }
811 return seed;
812}
813#endif
814
815/*pcmain.c*/

Callers

nothing calls this directly

Calls 2

getnowFunction · 0.85
getpidFunction · 0.50

Tested by

no test coverage detected