ran·dom Pronunciation Key (rndm) adj. Having no specific pattern, purpose, or objective: random movements. See Synonyms at chance.
If I toss a coin in the air, the landing, be it heads or tails, is random. It's simple probability. If I stick a bunch of names in a hat, and draw one, the result is random. It's simple probability. Just declaring it "random" doesn't explain HOW the pick is made. THAT was CajunMan's question.
EDIT: Next time, put a little thought into your post before jumping at the opportunity to be a smartass.
(edited by TheBucsFan on 1.3.02 2110)
Thank You BUCSFAN, Right on the mark!
AS For S.S.S point..... I would like to see Brian Pillman win this award once.
Oh, it's actually interesting trying to get a computer to generate a random set of numbers. Mostly, though, people use a feedback shift register (or multiplicative congruential random-number generator), for a pseudo-random bit sequence.
The implementation in C is of a feedback shift register with a XOR tap on two of the bins provides the shift in input. The condition for finding the taps is that the values must be prime and irreducable in the Galois field, so the the number of states will be 2^(number of bins)-1. (The -1 is because all zeros in the register will "lock" the generator.) The random function requires a seed value, usually taken as the smallest incremental value of the system clock. If an identical seed value is given, the same sequence of random numbers will be produced, hence the term pseudo-random. Although with 2^32 states, it's probably not an issue, provided a unique seed is given, although it is totally unsuitable for generating one-time pads or crypto keys.
select id from users where powerlevel > -1 and powerlevel < 3 and id > rand()*$maxid limit 1
This says, get an id number (obviously the unique identifier for a given user on the board) from the table `users' where the `powerlevel' is greater than -1 (-1 is probably `guest') and `powerlevel' is less than 3 (3 is probably `moderator') and the id number is greater than a random number between 0 and 1 times the largest id in the table; only take one.
I assume he's using "id > rand() * $maxid" because though he'll get a userid from a valid range (i.e. 1 to the total number of users), but there's a chance that id may be inert (account deleted, id number still there for historical reasons) or that the function "rand() * $maxid" returns a result that is excluded by the previous clause (i.e. "powerlevel > -1 and powerlevel < 3"). So it'll keep adding 1 to the userid until it finds one that meets all conditions. The "limit 1" clause says only take the first one ye find.
See aureole's post about what rand() is likely to return.
I refer you to the MySQL documentation and/or the SQL-92 standard for specifics about how MySQL performs all of these operations.
HEh. You guys are making way to big of a deal about this. Its just a random award. Who cares what the code is and the math crap is. Just be thankful you were the "lucky" Wiener.
This has got to be one of the most useless threads I have ever seen on this board and that includes any and all threads started by ironcladlou.......makes me glad I don't log in everyday - sorry CRZ :)
Stylin' and Profilin' - Custom Made from Head to Toe.....courtesy of Michael's of Kansas City
Me Say Dis...Why not have top five weiners so that not as many people are left out. Or a message saying "'X' is weiner of the day, but we still love the rest of you". I'm just thinking that this random process may make people feel like outcasts and end their pitiful lives or somesuch.
I Think We Can All Agree That That Was The Greatest Post In The History Of Our Sport!
Is there any way to get an email when you are selected? Nothing fancy, just an automatic email that says something like "Greetings! CRZ bestows upon you 'Wiener of the Day' status." That way you'll be sure to stop by and bask in your Wiener-ocity.
Matthew: You would've loved it, David. A week in a foreign country, strange people, strange customs... Dave: Oh, I know what you mean. I've been to Canada.
Matthew: You would've loved it, David. A week in a foreign country, strange people, strange customs... Dave: Oh, I know what you mean. I've been to Canada.
Thread05/20Total11The Price is Right double showcase winner rule?150291572Money in the Bank Prediction Thread110112133Hyatte5812224EWR on Seinfeld532514895 The Un-Official Miss Elizabeth Upskirt Tally457091866Whatever Happened to Chris Hyatte??