• Ken B. (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.
    What do you mean "if"? Look up "regular polyhedron" in your favorite search engine, and see Tetrahedron (4), Cube (6) , Octahedron (8), Dodecahedron (12), and Icosahedron (20). Or, just ask your local dungeon master.
  • Ken B. (unregistered) in reply to PG4
    PG4:
    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" without being laughed at.

    FTFY.

  • Doozerboy (unregistered)

    You get to sit on your arse all day eating donuts too

  • Me (unregistered) in reply to drusi
    drusi:
    Will improve the randomness by what? BY WHAT?!

    Yeah, don't keep us hanging like this. We need to know.

  • Jerry (unregistered)
    horrible posts – such as manning the speed trap – that just suck the life out of most people for eight hours
    Guess what, cops! We don't like speed traps either. In many cases it is just glorified highway robbery: I pass your ambush, you threaten me with my weapons to extract some cash.
  • Yeah (unregistered)

    I had a pretty good idea what this one was going to be just by reading the title. Back in my very early programming days -- I think I had just discovered loops -- I noticed that the RNG in my programming language returned the same sequence every time. My fix: randomly skip over the first X values so I could at least start at a different place in the sequence. Didn't even finish coding it before I realized nope, that's not it.

  • plaga (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 )
    Try this: 45 + 1 == (22 + 1) + (22 + 1)
  • uuang (unregistered)

    wat....

    wat.

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

    Not if you like job security, fresh air, benefits, annual pay raises, bribes or power trips.

  • Stephen Cleary (unregistered)

    What's with all the hatred toward officers?

    They put their lives on the line almost every day for your safety. Yes, you - the ones with bad attitudes.

    Captcha: "vindico" - someone who is vindictive, e.g., a TDWTF poster talking about cops.

  • Marc (unregistered) in reply to Jeff
    Jeff:
    I'm pretty sure this is the same function they use for selecting for jury duty...
    I actually wrote a jury selection program, long enough ago that it was in COBOL. And did I get to use my computer science degree and my experience tinkering with random numbers? No. The "random" algorithm was spelled out right in the law:
    1. Combine the voter registration list with the drivers' license list.
    2. Eliminate duplicates. Of course, "JOE JONES" and "JOSEPH JONES" would not be considered duplicates, so if you really like jury duty, keep that in mind when you fill out your voter card.
    3. Start with name M on the resulting list.
    4. Summon person M and every Nth person after M.

    (Where M and N were provided before each run by the jury commissioner.)

    Curiously, after just a few runs my program selected me!

  • English Man (unregistered)

    I hope he added functionality to ensure he would only ever get allocated good jobs.

  • Jerry (unregistered) in reply to Stephen Cleary
    Stephen Cleary:
    What's with all the hatred toward officers?

    They put their lives on the line almost every day for your safety. Yes, you - the ones with bad attitudes.

    Safety is an impossible goal, and the excuse for everything from expensive retrofit construction projects to TSA fondling 3 year olds.

    The rightful role of law enforcement is to help victims pursue justice, not to bury us with micromanagement of victimless activities and stomp around on a power trip trying to control everyone and everything in sight.

    Oh, yeah, and the average cop is in no more danger than a construction worker, liquor store owner, factory grunt or any of a thousand other slightly hazardous jobs.

  • Seirios (unregistered)

    Well, if you add enough random results, the result becomes normally distributed. TWTF is that it should be applied multiple times.

  • Ernie (unregistered) in reply to Nook Schreier

    Cops in my town make over 100k a year for busting drunk's skulls in. Sign me up tomorrow!

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

    }

    +1

    -1 because it is basically stolen: http://xkcd.com/221/

  • Bill (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?

    Easy, you number the sides from 0 through 5.

  • Dan (unregistered) in reply to Ken B.
    Ken B.:
    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.)

    Sometimes good numbers go bad, which is why you need Internal Affairs.

  • transverbero (unregistered) in reply to Stephen Cleary
    Stephen Cleary:
    What's with all the hatred toward officers?

    They put their lives on the line almost every day for your safety. Yes, you - the ones with bad attitudes.

    Captcha: "vindico" - someone who is vindictive, e.g., a TDWTF poster talking about cops.

    Who is more likely to become a cop: a school bully or one of the nerds he is bullying? Who is more likely to become an IT worker posting comments on TDWTF: a school bully or one of the nerds he is bullying?

  • mara (unregistered) in reply to Bill
    Bill:
    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?

    Easy, you number the sides from 0 through 5.

    +1

  • (cs) in reply to Ken B.
    Ken B.:
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
    What do you mean "if"? Look up "regular polyhedron" in your favorite search engine, and see Tetrahedron (4), Cube (6) , Octahedron (8), Dodecahedron (12), and Icosahedron (20). Or, just ask your local dungeon master.

    You forgot the Decaeder ;)

  • Luiz Felipe (unregistered)

    In fact, the basic`s random algorithm is poor, it dont generate equaly distributed numbers, if your take the sum of probabylities you can enhance its distribution equality, but you need to iterate more times. The algoritims is wrong, but is not an wtf at all.

  • Jay (unregistered)

    I can't help but wonder if when the average young man joins the police force, if he doesn't have fantasies of single-handedly foiling an armed robbery, or rescuing a small child from a burning car, or similar heroics. Then he's assigned to hand out tickets to people who don't quite come to a complete stop at the stop sign.

    My son-in-law is a cop. He tells me he spends most of his time driving drunks home. I think his most exciting case was when a woman called 911 and demanded that they arrest her husband. It turned out that she had told him to pick up a gallon of milk on his way home and he hadn't done it.

  • Jay (unregistered) in reply to iToad
    iToad:
    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.

    I think the reason why they don't let me carry a gun on the job is that they know I often have meetings with users who imagine that they know how to design a database, and management is afraid of what might happen.

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

    }

    +1

    -1 because it is basically stolen: http://xkcd.com/221/
    +2. +1 because the comic fits the situation/story and +1 beacuse of a good post.

    CAPTCHA: dolor (sit amet etc.)

  • still not right. (unregistered) in reply to mara
    mara:
    Bill:
    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?

    Easy, you number the sides from 0 through 5.

    +1

    Then how do you roll 11 or 12?

  • A Criminal (according to the pigs) (unregistered) in reply to Anonymous
    Anonymous:
    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?

    QFT, 100%.

  • (cs) 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....

    I'll admit I'm not a craps expert, but rolling a 1 will probably mean the house gets your money. And of course all your bets like "hard six" that rely on two dice being present... the house wins those bets too.

    So they might be surprisingly receptive to your idea...

  • (cs)

    They're playing a quick game of Good Random, Bad Random to make the perp sweat a bit.

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

    }

    +1

    No, no, Officer #5 is still alive.

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

    That'd be a trick, since it's not.

    Can't roll a 1 with 2 six sided, and six sided outcome maps a bell curve, where as a 12 sided dice would be linear.

  • (cs) in reply to Anon
    Anon:
    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.

    XD.

    I heard that the Baltimore PD Homicide unit ordered a customized version of this app. The major difference was that iGoodRandom and iBadRandom were consolidated into the array iBadRandom().

  • Azd (unregistered)

    This remind me of some code I found in our code base recently which required a unique identifier to be assigned to tasks that are generated on a distributed system, the code to produce this identifier was:

     int id = new Random().Next(100);
    

    So I suggested to the original developer that we are quite likely to see some collisions here, if your going to use an int you at least need a bigger range. So the code was changed to:

     // Increase range from 0 - 10000
     int id = new Random().Next(100) * 10000;
    

    Well, I got what I asked for! :D

  • A Gould (unregistered) in reply to Ken B.
    Ken B.:
    PG4:
    Also, you get to say "Respect My Authority" without being laughed at to your face (they'll wait until you drive away.
    FTFY.
    FTFY.
  • Nico (unregistered) in reply to Caffeine

    Please tell us how You roll 1 with two six sided dices...

  • by (unregistered) in reply to Nico
    Nico:
    Please tell us how You roll 1 with two six sided dices...

    ... glad you joined the party, someone already said that. Oh and dice is already plural. :P

  • David Wright (unregistered)

    For some purposes, the built in Rand() function isn't good enough - especially if it generates a repeatable sequence of 32 bit numbers and you need something unpredictable to the level needed for secure cryptography.

    At the risk of adding something useful to this discussion, I cite RFC 1750, Randomness Recommendations for Security.

    That (and the now obsolete RFC 822) are the only two RFCs I can cite by number without looking up.

  • publiclurker (unregistered) in reply to Ken B.

    I asked my local Dungeon Master, and Mistress Mona had some rather interesting suggestions.

  • (cs) in reply to Ken B.
    SuperRand:
    Rnd will return a number 0<=x<1
    Ah yes, I had mistakenly assumed it would be 0<=x<=1
  • letatio (unregistered) in reply to Arancaytar
    Arancaytar:
    No, no, Officer #5 is still alive.
    No disassemble Number Five! Number 5 is alive.
  • a banana (unregistered)

    Shortly after, people notice the "random" schedule assignments seem a lot less predictable. The boss examines why this is, sees that Brian has sabotaged his clever SuperRand function and replaced it with the standard, biased random function (and he must have done this deliberately since the comment explains the function's purpose) and fires him on the spot.

  • KMP (unregistered)

    This article reminds me of dilbert's adventures in accouting.

    http://dilbert.com/strips/comic/2001-10-25/

  • by (unregistered) in reply to letatio
    letatio:
    Arancaytar:
    No, no, Officer #5 is still alive.
    No disassemble Number Five! Number 5 is alive.

    +1

    awsome movie (still)...

  • verto (unregistered) in reply to publiclurker
    publiclurker:
    Ken B.:
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
    What do you mean "if"? Look up "regular polyhedron" in your favorite search engine, and see Tetrahedron (4), Cube (6) , Octahedron (8), Dodecahedron (12), and Icosahedron (20). Or, just ask your local dungeon master.
    I asked my local Dungeon Master, and Mistress Mona had some rather interesting suggestions.
    Wrong kind of dungeon master, you pervert.
  • by (unregistered) in reply to verto
    verto:
    publiclurker:
    Ken B.:
    Markp:
    Rolling a 12-side die would theoretically result in equal probability of numbers 1-12, if such a die can be made.
    What do you mean "if"? Look up "regular polyhedron" in your favorite search engine, and see Tetrahedron (4), Cube (6) , Octahedron (8), Dodecahedron (12), and Icosahedron (20). Or, just ask your local dungeon master.
    I asked my local Dungeon Master, and Mistress Mona had some rather interesting suggestions.
    Wrong kind of dungeon master, you pervert.

    No, I think he's right on the money (shot)... :)

  • Random (unregistered) in reply to john
    john:
    That'd be a trick, since it's not.

    Can't roll a 1 with 2 six sided, and six sided outcome maps a bell curve, where as a 12 sided dice would be linear.

    The probability distribution of two six-sided dice doesn't come close to a bell curve (see here). Now, the probability distribution of N dice approaches the normal distribution as N->infinity (and for even N=10 or so, it's close), but that's different.

  • johnny_bgoode (unregistered)

    this comment does not produce true comment. adding comments together will improve true commentivity by

  • Marvin the Martian (unregistered) in reply to still not right.
    still not right.:
    Bill:
    Bill's Kid:
    How do you role a "1" with two six-sided die? Or was that sarcasm?
    Easy, you number the sides from 0 through 5.
    Then how do you roll 11 or 12?
    Easy: number one die 0-5, number the other 1,2,3,5,6,7.

    YDMV (Your distribution may vary)

  • (cs)

    Dumb question... Do you get a gaussian distribution from rolling two 6-sided dice?

  • Dirk (unregistered) in reply to George Nacht
    George Nacht:
    And half an hour to convince the boos, that his algorithm is flawed...
    Best typo ever!

Leave a comment on “SuperRand”

Log In or post as a guest

Replying to comment #:

« Return to Article