Path: utzoo!attcan!uunet!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!usc!apple!vsi1!zorch!ditka!nfsun!eklektik!eric From: eric@eklektik.UUCP (/dev/tty000) Newsgroups: comp.sys.amiga Subject: Re: Random sound on Startup... Message-ID: <4933@eklektik.UUCP> Date: 1 Aug 90 11:25:19 GMT References: <3769@crash.cts.com> Reply-To: eric@eklektik.UUCP (/dev/tty000) Organization: Computers, Gerbils, and Games in the Basement, Pgh, PA Lines: 43 In article <3769@crash.cts.com> seanc@pro-party.cts.com (Sean Cunningham) writes: >I'd like to setup my startup-sequence to play a sample when I boot-up, but I >don't want it to be the same one everytime. I figured I could make a >directory with ten sounds numbered from 0 to 9, and then for the randomness, >look at whatever value is in the second's place on my internal clock. I've done a similar thing in my startup using ARexx and Joe Hitchens' nifty Tapestry program. This randomly chooses a picture out of my s:pix directory and installs it as a backdrop picture. Basically, all it does is do a directory of s:pix, counts the files, choose one randomly, then call tapestry. The complete script is here. (Most of it is a custom random function, rxandom(), since ARexx's builtin random function kept giving me the same pictures...) ------------- Cut Here -------------- /* Tapestry.rexx -- Randomly choose a picture file for tapestry to display */ files = showdir("s:pix") RandomSeed=1000*time('S') address command "run tapestry s:pix/"||word(files,rxandom(1,words(files))) exit rxandom: arg rmin,rmax ARAND = 16807 MRAND = 2147483647 QRAND = 127773 RRAND = 2836 hi = RandomSeed%QRAND lo = RandomSeed//QRAND test = ARAND*lo + RRAND*hi if test>0 then RandomSeed = test else RandomSeed=test+MRAND r=min(rmax,((RandomSeed/2175506758)*(rmax-rmin+1)%1)+rmin) return r ------------- Cut Here -------------- -- --------------------------------------- Eric Kennedy eric@eklektik.pgh.pa.us (formerly ejkst@pitt.UUCP) ...pitt!idis!eklektik!eric