Re: Non-repeating Random Numbers - CORRECTION
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 43041
interpreted = N
texte = Andrew,I don't really want to search a .db that's why I went the route I did...but I'm sure your code works fine...Seems I spoke too soon..previous code was showing duplicate #s (read: not working as intended) so I altered the code slightly from before, and it appears to work. For anyone who's interested here is working code (Andrew (and any 'grown-ups')can ignore this... ;)[!] -- Randomly generate 6 unique numbers between 1 and 54 -- [/!][text show=f]unique_numbers=[/text][math show=f]found=0[/math][loop start=1&end=20][text show=f]random_number=[math]ceil([RANDOM format=float]*(54))[/math][/text][hideif [unique_numbers]^[random_number]][text show=f]unique_numbers=[unique_numbers][random_number] [/text][math show=f]found=[found]+1[/math][/hideif][showif [found]=6][break][/showif][/loop][unique_numbers]-Dan-------------------------------------------http://www.StrongGraphicDesign.com(208) 319-0137 | Toll-free p/f 877-561-1656On Mon, 2 Sep 2002 11:08:32 Andrew Simpson
wrote:>whats wrong with :>>[search>db=/db/54numbersfrom1-54.db&neNUMBERdatarq=[BLANK]&raNUMBERsort=1&NUMBERtype>=NUM&max=6]> [founditems][number]
[/founditems]>[/search]>>>----- Original Message ----->From: Dan Strong >To: WebCatalog Talk >Sent: Monday, September 02, 2002 10:46 AM>Subject: Re: Non-repeating Random Numbers - CORRECTION>>>> whoops...>> [showif [found]=5][break][/showif]>> should say 6, not 5... corrected code below:>>>> [!] --- Generate 6 unique numbers between 1 and 54 --->> [/!]>> [text show=f]unique_numbers= [/text]>> [math show=f]found=0[/math]>> [loop start=1&end=20]>> [text show=f]random_number=[math]ceil([RANDOM>> format=float]*(54))[/math][/text]>> [showif [unique_numbers]! [random_number] ]>> [text>> show=f]unique_numbers=[unique_numbers][random_number]>> [/text]>> [math show=f]found=[found]+1[/math]>> [/showif]>> [showif [found]=6][break][/showif]>> [/loop]>> [unique_numbers]>>>> -Dan>> ------------------------------------------->> http://www.StrongGraphicDesign.com>> (208) 319-0137 | Toll-free p/f 877-561-1656>>>>>> ------------------------------------------------------------->> This message is sent to you because you are subscribed >>to>> the mailing list .>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to>>> Web Archive of this list is at: >>http://search.smithmicro.com/>>>------------------------------------------------------------->This message is sent to you because you are subscribed to> the mailing list .>To unsubscribe, E-mail to: >>To switch to the DIGEST mode, E-mail to >>Web Archive of this list is at: >http://search.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Andrew,I don't really want to search a .db that's why I went the route I did...but I'm sure your code works fine...Seems I spoke too soon..previous code was showing duplicate #s (read: not working as intended) so I altered the code slightly from before, and it appears to work. For anyone who's interested here is working code (Andrew (and any 'grown-ups')can ignore this... ;)[!] -- Randomly generate 6 unique numbers between 1 and 54 -- [/!][text show=f]unique_numbers=[/text][math show=f]found=0[/math][loop start=1&end=20][text show=f]random_number=[math]ceil([RANDOM format=float]*(54))[/math][/text][hideif [unique_numbers]^[random_number]][text show=f]unique_numbers=[unique_numbers][random_number] [/text][math show=f]found=[found]+1[/math][/hideif][showif [found]=6][break][/showif][/loop][unique_numbers]-Dan-------------------------------------------http://www.StrongGraphicDesign.com(208) 319-0137 | Toll-free p/f 877-561-1656On Mon, 2 Sep 2002 11:08:32 Andrew Simpson wrote:>whats wrong with :>>[search>db=/db/54numbersfrom1-54.db&neNUMBERdatarq=[BLANK]&raNUMBERsort=1&NUMBERtype>=NUM&max=6]> [founditems][number]
[/founditems]>[/search]>>>----- Original Message ----->From: Dan Strong >To: WebCatalog Talk >Sent: Monday, September 02, 2002 10:46 AM>Subject: Re: Non-repeating Random Numbers - CORRECTION>>>> whoops...>> [showif [found]=5][break][/showif]>> should say 6, not 5... corrected code below:>>>> [!] --- Generate 6 unique numbers between 1 and 54 --->> [/!]>> [text show=f]unique_numbers= [/text]>> [math show=f]found=0[/math]>> [loop start=1&end=20]>> [text show=f]random_number=[math]ceil([RANDOM>> format=float]*(54))[/math][/text]>> [showif [unique_numbers]! [random_number] ]>> [text>> show=f]unique_numbers=[unique_numbers][random_number]>> [/text]>> [math show=f]found=[found]+1[/math]>> [/showif]>> [showif [found]=6][break][/showif]>> [/loop]>> [unique_numbers]>>>> -Dan>> ------------------------------------------->> http://www.StrongGraphicDesign.com>> (208) 319-0137 | Toll-free p/f 877-561-1656>>>>>> ------------------------------------------------------------->> This message is sent to you because you are subscribed >>to>> the mailing list .>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to>>> Web Archive of this list is at: >>http://search.smithmicro.com/>>>------------------------------------------------------------->This message is sent to you because you are subscribed to> the mailing list .>To unsubscribe, E-mail to: >>To switch to the DIGEST mode, E-mail to >>Web Archive of this list is at: >http://search.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Dan Strong
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Looking up two prices in Formulas.db (1997)
Migrating to NT (1997)
Re:trouble (1997)
Searching on 3 different fields *CORRECTION* (2003)
suggestion (1997)
WebCat b15 Mac plug-in (1997)
Practice runs ? (1997)
two unique banners on one page (1997)
RE: [isfolder] and [filename] (1997)
Multiple catalog databases and showcart (1997)
Template Security error (1997)
Re: (1998)
textarea inputs and returns (1999)
WCS Newbie question (1997)
web delivery (1997)
Summing a field full of numbers ... (1997)
I want my files to have an asp file extension (1999)
Who's going to MacWorld? (1999)
Missing Cart Information (2003)
WebCat2b12 Mac.acgi--[searchstring] bug (1997)