• Caffeine (unregistered)

    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

  • no (unregistered)

    goodFri_stRandom!

    But the real WTF is that we cannot post "fri_st" posts anymore!

  • Warren (unregistered)

    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

  • Talis (unregistered)

    If I get this right, I'd prefer to be officer #1...

  • Ken B. (unregistered)

    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.)

  • Bob (unregistered)

    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.

  • (cs)

    Either I am ill (well, I kindof am), or the maths doesn't work... 46 + 1 != ( 23 + 1 ) + ( 23 + 1 )

  • (cs)

    Is it really undesirable to have a predictable rotating schedule of jobs?

    By the way, cops are TRWTF.

  • CoderHero (unregistered)

    ' 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...

  • Doozerboy (unregistered)

    The consultants won't be happy.

    Brian's stiffed them out of an easy pay cheque whenever the department wants to add more officers.

  • Jeff (unregistered)

    I'm pretty sure this is the same function they use for selecting for jury duty...

  • Monroe (unregistered)

    int getRandomNumber { return 4; //chosen by fair game of russian roulette. //dedicated to the memory of officer #4. //guaranteed to be random.

    }

  • Slicerwizard (unregistered)

    I just want to know how Brian's department gets to be a suburb. How's that work exactly?

  • SR (unregistered) in reply to Warren
    Warren:
    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

    "will improve the randomness by" not a jot? not one iota?

  • George Nacht (unregistered)

    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...

  • Bill's Kid (unregistered) in reply to Caffeine
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

  • Anonymous (unregistered)

    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?

  • (cs) in reply to Bill's Kid
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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

  • tom103 (unregistered)

    The real WTF is giving up software development to become a cop...

  • (cs) in reply to Bill's Kid
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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.

  • Dude (unregistered) in reply to Bill's Kid
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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

  • (cs) in reply to Markp
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
    "if"?

    http://www.cafepress.com/orderofthestick.38674424

  • PS (unregistered) in reply to Warren
    Warren:
    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

    Or maybe there were some tender sprouts of insights beginning to manifest.

    "... will improve the randomnes by ... by .... by ..... I gotta go!"

  • (cs) in reply to Markp
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.

    IF???? Turn in your geek card at the door.

  • Cyclops (unregistered) in reply to tom103
    tom103:
    The real WTF is giving up software development to become a cop...

    Beat me to it....

  • XXXX (unregistered)

    So what happens if the department hires more officers? Hardcoding constants that shouldn't be constant FTW!

  • (cs) in reply to tom103
    tom103:
    The real WTF is giving up software development to become a cop...

    It's less stressful. You also get in less trouble for having an attitude problem.

  • Mike (unregistered) in reply to Nook Schreier
    Nook Schreier:
    tom103:
    The real WTF is giving up software development to become a cop...

    It's less stressful. You also get actively commended and quickly promoted for having an attitude problem.

    FTFY.

  • Dude (unregistered) in reply to Markp
    Markp:
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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.

    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)

  • airdrik (unregistered) in reply to Bill's Kid
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    The same way the author expects to generate a 1 for iGoodRandom:

    Funtion MyRnd() As Integer
        MyRnd = Rnd - Rnd
    End Function
    
    Function MyInt(n As Float) As Integer
        If n < 0.5 then MyInt = Abs(n) End
        Else MyInt = n
    End Function
    
    'SuperRand function, only using MyRnd and MyInt in place of 
    'Rnd and Int, respectively
    

    Fixed?

  • Someone who can't be bothered to login from work (unregistered) in reply to Dude
    Dude:
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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

    And now I'm just going to be consulting WolframAlpha about average damage output in D&D.

  • Steve (unregistered) in reply to Markp
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
    Be honest, you're just trolling all the D&D players that you know are going to be amongst the readers here. Good work my friend!
  • airdrik (unregistered) in reply to Code Slave
    Code Slave:
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.

    IF???? Turn in your geek card at the door.

    +9 (chosen by rolling my 12-sided die - guaranteed to be random)

  • SR (unregistered) in reply to Markp
    Markp:
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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.

    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.

  • Hbuttle (unregistered) in reply to tom103
    tom103:
    The real WTF is giving up software development to become a cop...

    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.

  • (cs) in reply to Markp
    Markp:
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....

    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    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.

    The D&D nerd inside me just died a little.

  • Someone who can't be bothered to login from work (unregistered) in reply to tom103
    tom103:
    The real WTF is giving up software development to become a cop...

    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.

  • (cs)

    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.

  • Matt Westwood (unregistered)

    I have added your random numbers. Pray I don't add them any more.

  • Matt Westwood (unregistered) in reply to Monroe
    Monroe:
    int getRandomNumber { return 4; //chosen by fair game of russian roulette. //dedicated to the memory of officer #4. //guaranteed to be random.

    }

    +1

  • Matt Westwood (unregistered)

    What does a policeman say in bed?

    "Lie down! Spread your legs! Put your hands behind my back!"

  • drusi (unregistered) in reply to Warren

    Will improve the randomness by what? BY WHAT?!

  • by (unregistered) in reply to Matt Westwood
    Matt Westwood:
    I have added your random numbers. Pray I don't add them any more.

    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?

  • (cs) in reply to Someone who can't be bothered to login from work
    Someone who can't be bothered to login from work:
    tom103:
    The real WTF is giving up software development to become a cop...

    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.

    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.

  • Ken B. (unregistered) in reply to TarquinWJ
    TarquinWJ:
    Either I am ill (well, I kindof am), or the maths doesn't work... 46 + 1 != ( 23 + 1 ) + ( 23 + 1 )
    My understanding is that Rnd will return a number 0<=x<1, so it's really:

    (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.

  • Anon (unregistered)

    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.

  • iToad (unregistered) in reply to tom103
    tom103:
    The real WTF is giving up software development to become a cop...
    1. The pay is probably better. The cops have unions.

    2. The job security is way better - they're not going to outsource your job to India anytime soon.

    3. You don't spend all day in a cube.

    4. You get to carry a gun when you're working.

  • Ken B. (unregistered) in reply to Bill's Kid
    Bill's Kid:
    Caffeine:
    Now to convince the nice casino folk that using a 12 sided dice is the same as rolling 2 six sided dice....
    How do you role a "1" with two six-sided die?

    Or was that sarcasm?

    I see no need for sarcasm in that statement. Imagine a casino that plays craps with 1d12, yet pays out at the same odds as 2d6. Simply bet for "snake eyes" every time, now that it's 1-in-12 but pays as if it's 1-in-36. (Though for such a casino, I will retract my "zillion-to-one" payoff offer for rolling a 1 that I mentioned elsethread. Actually, I think I'll keep the offer, as long as I get to define "zillion".)

  • PG4 (unregistered)

    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"

  • (cs) in reply to Talis
    Talis:
    If I get this right, I'd prefer to be officer #1...
    Assuming of course that it's randomly choosing officers to add to the schedule. On the other hand, if it was randomly choosing who gets the day off, I'd want to be officer #24.

Leave a comment on “SuperRand”

Log In or post as a guest

Replying to comment #330472:

« Return to Article