Re: Non-repeating Random Numbers - CORRECTION

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 43068
interpreted = N
texte = > The way >your code is written below, the numbers 1 and 4 will >be rejected if the number 41 has already been chosen, >because 41 contains 1 and 4. Statistically, you >will have a significant shortage of 1-digit numbers.Yeah, I noticed that after the fact... since I wrote that code, I have discovered some more elegant (and correct) javascript solutions that I believe will work better for my purposes, though I haven't really committed to anything yet.> >Your code uses a space as a delimiter, which is fine, but >you need to initialize unique_numbers with a leading >space. John used + as his delimiter, my preference is >usually to use _ or |, but it's really up to you. > >Simply, to fix this problem in your code and continue >using the space delimiter, I would change two lines: > >[text show=f]unique_numbers= [/text] > ^ note the space character > >and > >[hideif [unique_numbers]^ [random_number] ] > ^ ^ note the >space charactersThanks, man. When I revisit my code, I will implement your fix. You know, it's funny, as apparently 'easy' as this widget appears to be on the surface, I have to admit that it is just over my head enough for me to have learned a few things that I didn't already know...webdna is fun...now if they can just implement the [create_cash/beer/bikini models_from_thin_air] I'd be all set :)-Dan --------------------------------------------------- http://www.StrongGraphicDesign.com (208) 319-0137 | Toll-free p/f 877-561-1656 --------------------------------------------------- 1000 Full Color Business Cards only $99!------------------------------------------------------------- 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:

    
  1. Re: Non-repeating Random Numbers - CORRECTION (Dan Strong 2002)
  2. Re: Non-repeating Random Numbers - CORRECTION (Brian Fries 2002)
  3. Re: Non-repeating Random Numbers - CORRECTION (Stuart Tremain 2002)
  4. Re: Non-repeating Random Numbers - CORRECTION (Dan Strong 2002)
  5. Re: Non-repeating Random Numbers - CORRECTION (Stuart Tremain 2002)
  6. Re: Non-repeating Random Numbers - CORRECTION (Andrew Simpson 2002)
  7. Re: Non-repeating Random Numbers - CORRECTION (Andrew Simpson 2002)
  8. Re: Non-repeating Random Numbers - CORRECTION (Dan Strong 2002)
  9. Re: Non-repeating Random Numbers - CORRECTION (Dan Strong 2002)
> The way >your code is written below, the numbers 1 and 4 will >be rejected if the number 41 has already been chosen, >because 41 contains 1 and 4. Statistically, you >will have a significant shortage of 1-digit numbers.Yeah, I noticed that after the fact... since I wrote that code, I have discovered some more elegant (and correct) javascript solutions that I believe will work better for my purposes, though I haven't really committed to anything yet.> >Your code uses a space as a delimiter, which is fine, but >you need to initialize unique_numbers with a leading >space. John used + as his delimiter, my preference is >usually to use _ or |, but it's really up to you. > >Simply, to fix this problem in your code and continue >using the space delimiter, I would change two lines: > >[text show=f]unique_numbers= [/text] > ^ note the space character > >and > >[hideif [unique_numbers]^ [random_number] ] > ^ ^ note the >space charactersThanks, man. When I revisit my code, I will implement your fix. You know, it's funny, as apparently 'easy' as this widget appears to be on the surface, I have to admit that it is just over my head enough for me to have learned a few things that I didn't already know...webdna is fun...now if they can just implement the [create_cash/beer/bikini models_from_thin_air] I'd be all set :)-Dan --------------------------------------------------- http://www.StrongGraphicDesign.com (208) 319-0137 | Toll-free p/f 877-561-1656 --------------------------------------------------- 1000 Full Color Business Cards only $99!------------------------------------------------------------- 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:

PCS Frames (1997) Multiple fields on 1 input (1997) Formatting dates stored in db (2003) Looking for easy way to back up dbs... (2003) Bug? (1997) Header info in content (1998) WebCatalog/Mac 2.1b2 New Features (1997) [WebDNA] [announce] WebDNA 6.2.1x (2012) WebCat for mass emailings (1997) Using Plug-In while running 1.6.1 (1997) OT-Load balance (2004) WC2b15 File Corruption (1997) WebCat2b12 - nesting [tags] (1997) Unexpected error (1997) searching illegal HTML (2002) Using Cookie for client specific info? (1997) Sendmail & Spell Checker (2001) Showif probably dumb question (1997) RV: Email Problem (2006) Re[2]: SSL data to/from webcatalog? (2000)