SUMMARY: rand

From: Thierry Chich <chich_at_cust.univ-bpclermont.fr>
Date: Fri, 18 May 2001 17:02:18 +0200 (MEST)

Thank you to Stan Horwitz and <sysadmin_at_astro.su.se>.

I have been a little bit a newbie with this question, since the
answer is in the man page for rand.

       static unsigned int next = 1;
       int myrand(void)
       {
               next = next * 1103515245 + 12345;
               return ( (next >>16) & RAND_MAX);
       }
       void mysrand (unsigned int seed)
       {
       next = seed
       }

Regards,
Thierry Chich
Received on Fri May 18 2001 - 15:03:22 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT