Re: random prob

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 50394
interpreted = N
texte = on 5/15/2003 11:06 am, Ron Ceballos at ron@specsimple.com so noted...> i'm having a bit of trouble with this code -- for the life of me i can't get > it to truly give me unique, random numbers, it always duplicates 2 values > > i've been working on it for quite a long time - please help.It sounds like you want a fixed set of numbers, in random order. I've probably read the problem entirely wrong. : )If so, you can create a list and shuffle its contents. I used text variables, but you could use an array if you're on the 5.0 bus.In this example, you'd set the value for [totalNumbers] to the number of SWF files in your selected folder. [text]totalNumbers=30[/text][loop start=1&end=[totalNumbers]] [text]number[index]=[index][/text] [/loop][loop start=1&end=[totalNumbers]] [math show=F]pick=floor([random format=float]*[totalNumbers])+1[/math] [text]temp=[text]number[index][/text][/text] [text]number[index]=[text]number[pick][/text][/text] [text]number[pick]=[temp][/text] [/loop][loop start=1&end=[totalNumbers]] [index]: [text]number[index][/text]
[/loop] Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.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://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: random prob (Ron Ceballos 2003)
  2. Re: random prob (Glenn Busbin 2003)
  3. Re: random prob (Rob Marquardt 2003)
  4. Re: random prob (Ron Ceballos 2003)
  5. Re: random prob (Glenn Busbin 2003)
  6. Re: random prob (Beljaeff, Gene 2003)
  7. Re: random prob (Rob Marquardt 2003)
  8. Re: random prob (Ron Ceballos 2003)
  9. Re: random prob (Rob Marquardt 2003)
  10. Re: random prob (Ron Ceballos 2003)
  11. Re: random prob (Rob Marquardt 2003)
  12. Re: random prob (John Peacock 2003)
  13. Re: random prob (Glenn Busbin 2003)
  14. Re: random prob (Ron Ceballos 2003)
  15. Re: random prob (Rob Marquardt 2003)
  16. random prob (Ron Ceballos 2003)
on 5/15/2003 11:06 am, Ron Ceballos at ron@specsimple.com so noted...> i'm having a bit of trouble with this code -- for the life of me i can't get > it to truly give me unique, random numbers, it always duplicates 2 values > > i've been working on it for quite a long time - please help.It sounds like you want a fixed set of numbers, in random order. I've probably read the problem entirely wrong. : )If so, you can create a list and shuffle its contents. I used text variables, but you could use an array if you're on the 5.0 bus.In this example, you'd set the value for [totalNumbers] to the number of SWF files in your selected folder. [text]totalNumbers=30[/text][loop start=1&end=[totalNumbers]] [text]number[index]=[index][/text] [/loop][loop start=1&end=[totalNumbers]] [math show=F]pick=floor([random format=float]*[totalNumbers])+1[/math] [text]temp=[text]number[index][/text][/text] [text]number[index]=[text]number[pick][/text][/text] [text]number[pick]=[temp][/text] [/loop][loop start=1&end=[totalNumbers]] [index]: [text]number[index][/text]
[/loop] Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.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://webdna.smithmicro.com/ Rob Marquardt

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:

CGI Plugin memory (2001) Wanted: More Math Functions (or, Can You Solve This?) (1997) Word wrapping (1997) Claris HomePage messes up the code (1997) PCS Frames (1997) Protecting Images (2003) RE:It just Does't add up!!! (1997) Date Sorting (1997) Getting total number of items ordered (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) showif comparison begins w/ and contains (1997) Secure Server (1999) [Announce]: Web server security and password protection (1997) add line item context and showitems (1998) JavaScript Image Problem (1998) Applying discounts as more items are added... (1997) CAPTCHA system in webDNA (2005) Some shell fun (2004) Max Record length restated as maybe bug (1997) Two prices in shoppingcart? (1997)