- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....
Admin
goodFri_stRandom!
But the real WTF is that we cannot post "fri_st" posts anymore!
Admin
The comment says it all - "will improve the randomness by" hanging there. You can imagine the author deleting the word "magic" that he had originally put next
Admin
If I get this right, I'd prefer to be officer #1...
Admin
Now, you just need to make sure that, when dealing with unwanted jobs, you're officer number 1 or 46, and when dealing with desirable jobs, you're officer 23 or 24.
And I love the logic -- "if the 'good' random number is equal to the 'bad' random number, regenerate the 'good' one." (I guess it wasn't so "good" after all.)
Admin
By "improve the randomness" does the author mean that the randomness will be more predictable? I guess that would be an improvement over randomness that was unpredictably non-random.
Admin
Either I am ill (well, I kindof am), or the maths doesn't work... 46 + 1 != ( 23 + 1 ) + ( 23 + 1 )
Admin
Is it really undesirable to have a predictable rotating schedule of jobs?
By the way, cops are TRWTF.
Admin
' NOTE: First post functions don't produce true first posts. ' adding them together will improve the firstiness by
Ah, who the hell am I kidding...
Admin
The consultants won't be happy.
Brian's stiffed them out of an easy pay cheque whenever the department wants to add more officers.
Admin
I'm pretty sure this is the same function they use for selecting for jury duty...
Admin
int getRandomNumber { return 4; //chosen by fair game of russian roulette. //dedicated to the memory of officer #4. //guaranteed to be random.
}
Admin
I just want to know how Brian's department gets to be a suburb. How's that work exactly?
Admin
"will improve the randomness by" not a jot? not one iota?
Admin
Not a long ago I was invited to help with a "math" problem. Friend of mine was calculating an average age of the employees in our company. His boss made the same calculation to verify and received wildly different results. Why? My friend summed up the age of every employee and divided it by the number of employees. His boss first calculated the average age of each of our five departments(each of very different size), added it together and divided by five. Took me ten seconds to find a mistake. And half an hour to convince the boos, that his algorithm is flawed...
Admin
How do you role a "1" with two six-sided die?
Or was that sarcasm?
Admin
Well that is pretty random - but not in the way the original coder intended.
On a related note, how exactly does a pig type in the first place? I'd imagine that the combination of trotters and ignorance would make it rather difficult. Did he just shove his gun in the keyboard's face until it relented and typed itself? Did he manage to pin a few rapes on it while he was there?
Admin
Clearly you have a third die which is two sided (0 and 1) and subtract that number from the total of the two six sided dice added together.
That's 3 times the randomness of a 12 sided die
Admin
The real WTF is giving up software development to become a cop...
Admin
Clearly. When adding two dice some numbers are more likely than others. 7 is much more likely than 2, e.g. Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
Admin
Considering that they have vastly different probabilities for each possible number rolled, that was sarcasm.
Check 12-sided die stats vs 2 6-sided die stats
Feeding the akismet.... dammit
Admin
http://www.cafepress.com/orderofthestick.38674424
Admin
Or maybe there were some tender sprouts of insights beginning to manifest.
"... will improve the randomnes by ... by .... by ..... I gotta go!"
Admin
IF???? Turn in your geek card at the door.
Admin
Beat me to it....
Admin
So what happens if the department hires more officers? Hardcoding constants that shouldn't be constant FTW!
Admin
It's less stressful. You also get in less trouble for having an attitude problem.
Admin
Admin
It's easy to make one, either a hexagonal trapezohedron (2 sets of 6 kites connected at the pointy ends with the sets connected by the fat ends) or a regular dodecahedron (12 regular pentagons connected by their sides)
Admin
The same way the author expects to generate a 1 for iGoodRandom:
Fixed?
Admin
And now I'm just going to be consulting WolframAlpha about average damage output in D&D.
Admin
Admin
Admin
It's noticably more probable that you'll roll a 1 with a 12-sided die vs 2 6-sided dice.
For what it's worth, I think it was sarcasm.
Admin
Tbh, I am seriously thinking about becoming ranger, becoming one with the rabbits and squirrels. And I don't think this is in conflict with geekdom. Cop, maybe, but forester, no.
Note though that I wouldn't give up my hobbyist ambitions.
Admin
The D&D nerd inside me just died a little.
Admin
Not really. Sometimes people just get sick of their job and want to do something else or they just feel that what they're doing is very rewarding and they want to do something else. I've considered it more than a few times.
Matthew Barlow quit Iced Earth for a while and became a police officer, although he's gone back to it now.
Admin
This is truly a clever function.
By "bad", I assume the author meant that "BadRandom" is in some way biased. "GoodRandom" would have to suffer from the same bias, since they are both generated using Rnd (which is clearly the real culprit here).
Now, let's say for sake of example that BadRandom and GoodRandom both have an upward bias. By ensuring that they are never equal (line 16), this increases the chances of choosing a value from the lower part of the range, effectively reversing the bias and making it super-random!
The only mistake the author made was to assume that adding two random numbers had any effect on the result. As someone already pointed out, rolling a 12-sided die is the exactly same as two 6-sided dice.
You may make fun of the code, but this brilliant sample of code is actually the work of a true genius. It should be no surprise that the author was a highly-paid consultant.
Disclaimer: Yes, I am kidding, except for the very last sentence.
Admin
I have added your random numbers. Pray I don't add them any more.
Admin
+1
Admin
What does a policeman say in bed?
"Lie down! Spread your legs! Put your hands behind my back!"
Admin
Will improve the randomness by what? BY WHAT?!
Admin
BOOOOO! Some memes just need to die...
(not you, just that some memes get so over used and abused, it becomes painful to read).
That being said, I think this is BRILLANT!
Finally, what this solution REALLY needs is some FILE_NOT_FOUND and XML... amirite?
Admin
Richard Christy quit Iced Earth to make prank phone calls and perform gay acts on satellite radio. I guess everybody has their own definition of rewarding.
Admin
(0..45)+1 --> 1 through 46 (0..23)+1 --> 1 through 23 (0..23)+1 + (0..23)+1 --> 2 through 46.
So, you are correct that they don't match, as the "good" random number generator will never generate 1. (I'll give you a zillion-to-one odds on rolling a 1 in craps.)
Of course, that ignores the rest of the "they're not the same thing" discussion, though it is yet another "why your 'good' version isn't" piece.
Admin
Clearly iGoodRandom is the sympathetic one that offers you a cigarette, then iBadRandom slaps it out of your mouth, shouts at you and threatens to hit you. iGoodRandom then jumps back in, holds iBadRandom back and then whispers that maybe you better just take the speed trap duty because iBadRandom is crazy and who knows what he'll do next.
Admin
The pay is probably better. The cops have unions.
The job security is way better - they're not going to outsource your job to India anytime soon.
You don't spend all day in a cube.
You get to carry a gun when you're working.
Admin
Admin
To all those wanting to know why one would quit software work and become a cop.
You get to carry a gun just about anywhere you want, and in some cases shoot people.
Also, you get to say "Respect My Authority"
Admin