Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!sunybcs!uhura.cc.rochester.edu!llkl From: llkl@uhura.cc.rochester.edu (Laurie Kleiner) Newsgroups: comp.sys.mac.hypercard Subject: Re: XFCN--randomly selecting a word from a field Keywords: XFCN Message-ID: <4531@ur-cc.UUCP> Date: 15 Dec 89 10:09:37 GMT References: <7417@hubcap.clemson.edu> <74944@tut.cis.ohio-state.edu> Reply-To: llkl@uhura.cc.rochester.edu (Laurie Kleiner) Organization: University of Rochester Lines: 30 In article <74944@tut.cis.ohio-state.edu> Howard P Marvel writes: >In article <7417@hubcap.clemson.edu> dragon@hubcap.clemson.edu (Michael E. Quattlebaum) writes: >>I need an XFCN that will go out and randomly select a word from a >>field. This will be used in an educational stack that selects >>words for a student to practice a spelling excercise. I will be >>willing to write this if need be, but why reinvent the wheel, huh? >>Please send e-mail with ftp sites, etc. if such a beast exists. > >Why do you need an XFCN? > > put the number of words in field spell into foo > put word random(foo) of field spell into spellword > If you don't want the words to be repeated within a test, then it's better to get the total number of words in the field, pick a random number, get the coresponding word, delete the nth word in the field. ie: put the number of words in field spell into foo put the random of number into bar put word bar of field spell into spellword delete word bar of field spell Getting the random number can be slow, and random doesn't work with values over 32767. -- ------------------------------------------------------------------------------- Laurie Kleiner LLKL_SS@DB1.CC.ROCHESTER.EDU Old enough to know better, stupid enough to do it anyhow. -------------------------------------------------------------------------------