• Yalpe Nismou (unregistered)

    So Mary is a boy's name where ?

  • Mr Mary (unregistered)

    TRWTF here is the gender param me thinks

  • Josh (unregistered)

    Chosen by fair sample from population. Guaranteed to be random.

  • (cs)

    http://xkcd.com/221/

    int getRandomNumber()
    {
        return 4;    // chosen by fair dice roll.
                     // guaranteed to be random.
    }
    
  • Bernard Mergendeiler (unregistered)

    Looks OK to me. One of my coworkers once wrote a random function which always returned 6. He argued that 6 was as likely as any other number.

  • pg4 (unregistered)

    And then along comes......

  • ds111 (unregistered)

    What do the "few places" do with it when they've called it? I suspect a few more WTFs lurking there.

  • (cs)

    Yet another falls victim to the "random" == "arbitrary" error.

  • Thg (unregistered) in reply to Yalpe Nismou
    Yalpe Nismou:
    So Mary is a boy's name where ?

    nowhere ... otherwise you wouldn't be insulting the guy's manhood when you used it as an insult.

    e.g., "Stop whining about the code, .. Mary."

  • Ed (unregistered)

    But we all know the getReallyRandom name will return . . . 'Dave'

  • (cs) in reply to Yalpe Nismou

    Well, if there can be a boy named "Sue"...

  • Anonymous Coward (unregistered) in reply to Mel
    Mel:
    Well, if there can be a boy named "Sue"...

    ...then we can meet our ellipsis quota for the day... or can we...?

  • Cujo (unregistered)

    I think it was to keep 'Paula' or 'Kevin' from popping up.

  • (cs)

    No the real WTF here is using PHP for OO. ;)

  • Ian (unregistered) in reply to Yalpe Nismou
    Yalpe Nismou:
    So Mary is a boy's name where ?

    Could be short for "Marion". Not common but there are some men with that name. Not up to par with "Kelly", "Chris", "Terry", "Courtney", "Pat", "Lynn" or "Beverly".

  • (cs)

    TRWTF is that just under half of the places where it is called use "true" as the param, just under half use "false" as the param, and the remainder use FILE_NOT_FOUND. There, that should dust it off nicely.

  • Kempeth (unregistered)

    You need to look for seedRandomNameGenerator(string name). It will change the name and recompile the code.

  • Steve the Cynic (unregistered)

    C'mon guys, is nobody (aside from me, that is) going to mention Marion Morrison in the quest for confused names?

    And never mind the problems my father had owing to the USian tendency to assume that Robin is a girl's name...

  • (cs)

    I'm guessing the coder initially put in a bogus return value just so it would return a string as expected, but forgot to go back later and actually make it do what was it was supposed to.

  • Steve the Cynic (unregistered) in reply to TarquinWJ
    TarquinWJ:
    TRWTF is that just under half of the places where it is called use "true" as the param, just under half use "false" as the param, and the remainder use FILE_NOT_FOUND. There, that should dust it off nicely.
    gender == true presumably would apply to the entire population, even those who are confused about what the gender actually is. We all *have* a gender, right?

    (Well, pedantically speaking, no, we don't. Gender is a concept in grammar, so "Gender Studies" is a narrow subfield of linguistics.)

  • Someone too lazy to login and at work (unregistered) in reply to Yalpe Nismou
    Yalpe Nismou:
    So Mary is a boy's name where ?

    In theory, anywhere you want. Erich Remarque's middle name was Maria.

  • Justsomedude (unregistered) in reply to Josh
    Josh:
    Chosen by fair dice roll from sample population. Guaranteed to be random.

    ftfy? or was that intentional?

  • F. G. (unregistered)

    You can never really know... [image]

  • () (unregistered)

    Actually, it makes a lot of sense. Someone wrote a mock for this function to test other functionalities and they accidentally forgot to implement the proper code. The only WTF I see here is not adding a "// TODO: implement this" and something like "#ifndef debug error 'the implementation is not finished'" Captcha: nulla (are we still posting the captchas?)

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    Mel:
    Well, if there can be a boy named "Sue"...

    ...then we can meet our ellipsis quota for the day... or can we...?

    What? It's a perfectly valid use, according to http://en.wikipedia.org/wiki/Ellipsis. "An ellipsis can also be used to indicate a pause in speech, an unfinished thought, or, at the end of a sentence, a trailing off into silence (aposiopesis) (apostrophe and elipsis mixed)."

    On the other hand, I did fail at quoting.

  • JakeyC (unregistered) in reply to Someone too lazy to login and at work
    Someone too lazy to login and at work:
    Yalpe Nismou:
    So Mary is a boy's name where ?

    In theory, anywhere you want. Erich Remarque's middle name was Maria.

    And one step closer, Charles Widor's was Marie...

  • SCB (unregistered) in reply to Steve the Cynic
    Steve the Cynic:
    TarquinWJ:
    TRWTF is that just under half of the places where it is called use "true" as the param, just under half use "false" as the param, and the remainder use FILE_NOT_FOUND. There, that should dust it off nicely.
    gender == true presumably would apply to the entire population, even those who are confused about what the gender actually is. We all *have* a gender, right?

    (Well, pedantically speaking, no, we don't. Gender is a concept in grammar, so "Gender Studies" is a narrow subfield of linguistics.)

    As the saying goes: Words have gender, people have sex.
  • (cs)

    Actually, the "really random" method is called "real_getRandomName".

  • Glen (unregistered)

    I guess there must be something about Mary.

  • (cs) in reply to ()

    we never were.

  • juca (unregistered)

    In embedded systems where you normally don't even have a file system, is very common to use Mary as a random name.

  • Sika (unregistered)

    Yet another thread on yet another forum with the same story, linking same xkcd and Dilbert...

  • Cypholus (unregistered)

    Not quite like kevin captcha secundum... On a second thought maybe mary is better

  • (cs)

    It should return "Slartybartfast". Now that's a random name.

  • (cs)

    It all depends on initial condidions. What is the universe of names that the function is supposed to choose from? Biblical names? Female names? English names? Employee database? Then - why would anyone need a random name? My first guess, to use in an example (credit card mockup) or in English tests ("Mary ________ to school"). On second guess, it could be used in advertisement. Say, a user is logged in - the ad shows him a credit card with his name on it. But what to do when the user is not logged in? Let's show him some random name - in this case Mary. It would be more fun though to have Heywood Jablome.

  • dacrocky (unregistered)

    you can just rename it to getTheRandomName then it will be true. =)

  • (cs) in reply to Yalpe Nismou
    Yalpe Nismou:
    So Mary is a boy's name where ?

    It's not an uncommon boy's name in Eire (Republic of Ireland)

  • Steve A (unregistered)

    Obligatory inane pop-culture reference:

    There's something about Mary...

  • (cs) in reply to mernen
    mernen:
    Actually, the "really random" method is called "real_getRandomName".
    Nah, do it the Oracle way--

    GET_RANDOM_NAME2

  • skinnytie (unregistered)

    TRWTF is that submitter's source control system did not provide him a changelog.

    I mean, he must be using a source control system, right?

  • Swedish tard (unregistered) in reply to ()
    ():
    Actually, it makes a lot of sense. Someone wrote a mock for this function to test other functionalities and they accidentally forgot to implement the proper code. The only WTF I see here is not adding a "// TODO: implement this" and something like "#ifndef debug error 'the implementation is not finished'" Captcha: nulla (are we still posting the captchas?)

    Oooh, Im SO going to start putting that into our codebase wherever I find a //TODO: or //FIXME: ... Might even modify our commit scripts to do it. :)

  • (cs)

    Mary is a boy's name where?

    Middle-Earth.

  • Montoya (unregistered)

    The coder clearly forgot to randomize the possibilities. Here is the correct way to do this:

    public static function getRandomName($gender) { $names = array('Mary'); shuffle($names); return $names[0]; }

  • (cs) in reply to NSCoder
    NSCoder:
    It should return "Slartybartfast". Now that's a random name.
    How big of a geek am I for immediately recognizing that the correct spelling of that is Slartibartfast?
  • K (unregistered) in reply to ds111
    ds111:
    What do the "few places" do with it when they've called it? I suspect a few more WTFs lurking there.

    It's a helper method for the random number generator.

    int randomNumber = getRandomName().ToCharArray().Count

  • Danny V (unregistered)

    Kevin would never have wrote something like that. He would have created a database of all possible names and returned a truly random result every time.

    Sure do miss that guy...

  • (cs)

    Allow me to refactor that for you:

    public static function getWhatTheWindCries($gender) { return 'Mary'; }
  • (cs)

    In Spanish, Italian, and probably a bunch of related languages, "Mario" is the masculine version of "Maria" (Mary), and is a fairly common male name.

  • (cs) in reply to jspenguin
    jspenguin:
    http://xkcd.com/221/
    int getRandomNumber()
    {
        return 4;    // chosen by fair dice roll.
                     // guaranteed to be random.
    }
    

    XKCD references are banned on the daily wtf - we have logged your IP address and will be running random DDoS

  • (cs) in reply to jspenguin
    jspenguin:
    http://xkcd.com/221/
    int getRandomNumber()
    {
        return 4;    // chosen by fair dice roll.
                     // guaranteed to be random.
    }
    

    Honestly, do you people just sit around all day waiting for opportunities to post the same two xkcd references?

Leave a comment on “Quite Contrary”

Log In or post as a guest

Replying to comment #:

« Return to Article