TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: CHRIS.SHUFFETT@PSCMAIL.PS.NET
date: 1997-09-24 05:02:00
subject: Re: Random Number Generator

mid__M3112717901.005.z2j45.1.970923174242Z.CC-MAIL*/OU=CCMAIL/O=PSC/PRMD=PSC/A
DMD=MCI/C=US/@MHS 80710001
From: 
     
______________________________ Forward Header 
__________________________________
Subject: Re: Random Number Generator
Author:  Chris Shuffett at psc-ah2
Date:    9/23/97 10:42 AM
     proc srand(integer multiplier)
         integer hrs
                ,min
                ,sec
                ,hun
     
         if multiplier == 0                    //Randomize via system clock
             GetTime(hrs,min,sec,hun)
             multiplier = sec * 100 + hun
             multiplier = multiplier * 0ffffh / 5999
         else
             multiplier = multiplier & 0ffffh  //Must be <= 0ffffh
         endif
     
         multiplier = multiplier | 1           //Add 1 if even 
         SetGlobalInt("randproc_multiplier",multiplier)
     end
     
     integer proc rand()
                 integer seed       = 37584381
                        ,multiplier = GetGlobalInt("randproc_multiplier") 
                        ,result
     
                 result = seed * multiplier
                 multiplier = result & 0ffffh
                 SetGlobalInt("randproc_multiplier",multiplier) 
                 result = result & 0ffff00h
                 result = result shr 8
                 return(result)
             end
     
     proc main()
     //  SetGlobalInt("randproc_multiplier",37)
         srand(0)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
         warn(rand() * 10000 / 10000h)
     end
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.