randomly select a contestant

Results 1 to 3 of 3

Thread: randomly select a contestant

  1. #1
    mark Guest

    Default randomly select a contestant

    I need to pull from a database several hundred thousands of ids of people who have entered a contest -- that I can do. Now I need to randomly select one winner out of these numbers, I know i need to put them in an array and then do a ubound and split at the comma and randomly select and do a response.write this number(i guess). How do I randomly select and post it-- I need a coding example. Any help is great!--Thanks

  2. #2
    Steve Cimino Guest

    Default RE: randomly select a contestant

    No coding examples, but I&#039ll point you in the direction.<BR><BR>Use the Randomize sub and Rnd function. You can find the details of these (and a better explanation) in the VBScript reference on the toolbar on your left.

  3. #3
    schnookums Guest

    Default RE: randomly select a contestant

    goto www.4guysfromrolla.com for an article (actually there are a few) on selecting a random record from a database. if you want to do it your way, assuming that you have an array containing the record ID&#039s called RECS... something like this should work:<BR><BR>randomize timer<BR>intMAX = ubound(RECS)<BR>intSelection = int(rnd * intMax)<BR>intWinner = RECS(intSelection)<BR><BR>

Posting Permissions

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