Path: utzoo!attcan!uunet!ns-mx!ceres!deimos.cis.ksu.edu!rutgers!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!brutus.cs.uiuc.edu!lll-winken!sun-barr!newstop!sun!amdahl!kim From: kim@uts.amdahl.com (Kim DeVaughn) Newsgroups: comp.lang.rexx Subject: Re: Arexx 'random' number generation Summary: Maybe this will do ... Message-ID: Date: 21 Nov 89 11:52:17 GMT References: <[255dd53e:14]comp.lang.rexx@tronsbox.UUCP> <89322.015245CMH117@PSU <[2567807d:14.4]comp.lang.rexx;1@tronsbox.UUCP> Organization: Amdahl Corporation, Sunnyvale, CA 94086 Lines: 35 In article <[2567807d:14.4]comp.lang.rexx;1@tronsbox.UUCP>, akcs.dfrancis@tronsbox.UUCP (Dennis Francis Heffernan) writes: > > I was really hoping that someone would tell me HOW to use the clock or > such to generate seed values, as that's something the manual doesn't seem > to cover. The following code fragment should show you how to use "random" to get a non- deterministic initialization. As an aside, it is part of some code I used to get a unique tempfile name in an ARexx clone of "readnews". It was implemented before v1.10 came out, hence the somewhat unusual use of "getspace()", etc. In v1.10 there is a "pragma" that eliminates the need to use "getspace()" in this way, and there's also a direct "d2x()" function in v1.10. /* */ [ ... ] call random(0, 255, time("S")) tmpfile = tempdir || "rnews" || translate((right(c2x(getspace(8)), 6) || c2x(d2c(random(0, 255)))), "abcdef", "ABCDEF") [ ... ] /kim -- UUCP: kim@amdahl.amdahl.com or: {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim DDD: 408-746-8462 USPS: Amdahl Corp. M/S 249, 1250 E. Arques Av, Sunnyvale, CA 94086 BIX: kdevaughn GEnie: K.DEVAUGHN CIS: 76535,25