(Pseudo) Random Number Generation

Results 1 to 3 of 3

Thread: (Pseudo) Random Number Generation

  1. #1
    Join Date
    Dec 1969

    Default (Pseudo) Random Number Generation

    Question:<BR>I understand that using Randomize and Rnd() to generate random numbers bases those (pseudo)random numbers off of the system timer (# seconds since midnight).<BR><BR>This is a problem for me... Here&#039s what I&#039m trying to do:<BR><BR>I&#039m building a site where I am anticipating heavy traffic. I also want to build in some security for my forms, so they are not submitted twice, and so some yahoo (not related to Yahoo!) doesn&#039t keep submitting it and filling my db with garbage.<BR><BR>So, I&#039m using a suggestion from 4guys and generating a unique id for every form and validating this formid in the next ASP. This unique id is generated like so:<BR><BR> Randomize<BR> formid = Date & Time & Rnd()<BR><BR>If multiple users call this page during the same second, could the system generate the same Rnd()? <BR><BR>For you computer science people, is there a seed OTHER than the system timer (default for randomizer) that will generate random numbers in other ways?<BR><BR>Thanks.<BR><BR>

  2. #2
    MG Guest

    Default RE: (Pseudo) Random Number Generation

    You might research using a GUID. You can get a free component to create GUIDs from http://www.serverobjects.com/products.htm#free.

  3. #3
    Sateesh Guest

    Default RE: (Pseudo) Random Number Generation

    I will not suggest this method even though the chances of getting the same id is negligable. i Hope you dont want the user to resubmitt the forms by pressing the refresh button or using the browser back and the submitt again. instead of generating and assigning id to the forms you can try the below method.<BR>when the user submitts the form you submitt the details and redirect him to an other page. since it is a redirect even when he presses the refresh the data will not be processed, even when he presses the browser back due to redirech it will bring him back to the same page without processing the data, try this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts