On 3/31/03 4:05 PM, "Eric Weidl" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
>> I'm building a random drawing system and all I'm going to do is insert a
>> random number in a column of an array and then sort the array and whoever is
>> at the top is the winner.
> 
> How are you ensuring that each random number in the array is unique?
> 
> If you aren't, then how do you decide who's the winner if 2 or more people
> have the same random number?
> 
> Are you sorting ascending or descending? How do you decide? It will affect
> who wins.
> 
> 
> Here's a method we've successfully used in the past to identify a random
> winner from a set of users.
> 
> 
> 1) Do a select action to get all the eligible contestants and their
> information. You could sort the data or not.
> 
> 2) In the results HTML for the search action, put the following code
> (modified for your table/column names, of course):
> 
> 
> <@! Set the range for the random number selection >
> <@ASSIGN local$randomRangeLow VALUE="1">
> <@ASSIGN local$randomRangeHigh VALUE="<@NUMROWS>">
> 
> <@! Pick a random winner from the range. The winnerIndex is the row number
> of the winner. >
> <@ASSIGN local$winnerRowIndex VALUE="<@RANDOM LOW='<@VAR randomRangeLow>'
> HIGH='<@VAR randomRangeHigh>'>">
> 
> <@! And the winner is... >
> <@VAR resultSet[<@VAR winnerRowIndex>,*]>
> 
> 
> 
> 
> Hope this helps.
> 
> Eric
> 
> ________________________________________________________________________
> TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
>               with unsubscribe witango-talk in the message body


Again
This is a great idea. Thanks!!

This one I will try.

Steve


________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to