Xref: utzoo comp.unix.programmer:759 comp.sys.next:11085 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!udel!haven!umd5!is-next.umd.edu!matthews From: matthews@is-next.umd.edu (Mike Matthews) Newsgroups: comp.unix.programmer,comp.sys.next Subject: random number generator Message-ID: <7781@umd5.umd.edu> Date: 29 Dec 90 00:24:42 GMT Sender: news@umd5.umd.edu Organization: Comp. Sci. Ctr., Univ. of MD, College Park, MD 20742 Lines: 17 Originator: matthews@is-next.umd.edu I'm trying to make a random sound player for my NeXT, using a shell script and crontab.local. I have everything working just fine, except for one small thing: the random numbers aren't really random. They always start at the same thing. Now, I know a little about how this works, and I know it has something to do with setting the seed (or the state -- I'm using the newer random() function), but how can I set *that* randomly every time the script is run? I essentially do a set num=`random `, then a /usr/bin/sndplay /usr/local/snds/$num.snd, which works, but it always plays the same sound... Any help would be appreciated. I was thinking I could just do a srandom(x) but that would still be a "fixed" random marker, wouldn't it? Please reply by Email to matthews@is-next.umd.edu, and I will post the answer if/when I get it. Thanks again, Mike