• Mike (unregistered)

    function getRandomChar(temp) dim c c= "S" select case temp mod 36 case 0 c="F" case 1 c="I" case 2 c="R" case 3 c="S" case 4 c="T" case 5 c=" " case 6 c="P" case 7 c="O" case 8 c="S" case 9 c="T" case 10 c="!" end select getRandomChar=c end function

  • Buffoon (unregistered)

    Frist Haha

  • XXXXX (unregistered)

    TRWTF, is that there isn't a comment instructing the user to invoke RandDouble() a random number of times to ensure that the randomly selected index of the randomized array of random numbers is random. Otherwise, you risk pseudorandomness.

  • Toon (unregistered)

    Not being familiar with VB, I assume that no "break" statements are needed?

  • DonaldK (unregistered)

    Cleanliness is close to godliness.

    That code is NOT clean. Quite the opposite.

    So: that code must be EVIL.

  • envelope (unregistered)

    TRWTF is VB

  • Dima Polovinkin (unregistered)

    Why didn't he shuffle it random number of times?

  • (cs) in reply to DonaldK
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

  • (cs)

    I did it that way once. Then I wrote my second program and never did it again.

  • Robyrt (unregistered) in reply to frits
    frits:
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

    The phrase dates to John Wesley in 1791. So "biblical proverb" isn't a bad guess.

  • (cs)

    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

  • (cs)

    This is a random comment.

    Oh wait, it isn't...

  • YF (unregistered) in reply to renewest
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    99% of our daily WTF situations can be found in either XKCD or Dilbert.

  • (cs)

    "As a student, I don't really feel qualified to what good and bad code is"

    Also not qualified to what good and bad English is.

  • Mike (unregistered)

    I will never for the life of me understand why people feel that they will get a "better" random number by calling a rand() function a rand() number of times, or some variation of that idea.

    For 99% of what you are doing, the built in rand() functions of most languages are fine. If you are working in the 1%, you probably already know what you are doing and your code wont wind up here anyway.

    //Captcha: praesent - is it Christmas already?

  • anon (unregistered) in reply to Robyrt
    Robyrt:
    frits:
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

    The phrase dates to John Wesley in 1791. So "biblical proverb" isn't a bad guess.

    1778, John Wesley was a dying old man in the few months of 1791 he was alive for and no longer preaching. But that's the first recorded usage of the exact phrase, the basic idea predates Christianity.

  • acsi (unregistered)

    Based on that xkcd comic, surely this is how the first example should have been written:

    function getRandomChar(temp)
        dim c 
        c= "S"
        select case temp mod 36
        case 0
            c="F" 'randomly chosen letter
        case 1 
            c="F"
        case 2
            c="F"
        case 3
            c="F"
        case 4
            c="F"
        case 5
            c="F"
        case 6
            c="F"
        case 7
            c="F"
        case 8
            c="F"
    
    <snip for sanity>
    
        case 35
            c="F"
        end select
        getRandomChar="G"
    end function
    

    Captcha acsi... how appropriate.

  • (cs)

    Just remember to put your money on '7' and wait it out. And never bet on 'S'

  • wonk (unregistered) in reply to YF
    YF:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    99% of our daily WTF situations can be found in either XKCD or Dilbert.

    So...we are the 99%?

  • Steve The Pirate (unregistered)

    I am no VB expert, but doesn't Asc return the Integer value of a given character. How would that do anything remotely like what the first function is doing? Doesn't he want Chr or ChrW?

  • ted (unregistered) in reply to renewest
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd. It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    You probably still use lmgtfy and think you're so damn clever.

    It means in real life, you're an unoriginal hipster doofus.

    Got anything to do with sanitizing inputs to a SQL database, etc.? Link to Bobby Tables. Got a nerd-project slow-ass turing machine? Like a minecraft logic circuit from redstone? Link to the one where it's some guy alone in the world making a computer out of rocks. Got a story about password security or encryption? Link to the one where they beat the password out of the guy with a wrench.

    Fuck off. You're not clever.

  • (cs)

    I'd like to see the implementation for shuffle()... it must be an extension method since Array does not have a shuffle method.

    I also like how the Randomize function is called with a seed from Rnd... another level of randomization!

  • (cs)
    "...he responded that this seemed cleaner."
    And did you explain to him that it wasn't? After all, cleanliness is in the eye of the maintainer.
  • H8r (unregistered) in reply to boog
    boog:
    "...he responded that this seemed cleaner."
    And did you explain to him that it wasn't? After all, cleanliness is in the eye of the maintainer.
    Exactly the sort of sentiment I would expect from a basement-troll. Or Nagesh.
  • (cs) in reply to H8r
    H8r:
    boog:
    "...he responded that this seemed cleaner."
    And did you explain to him that it wasn't? After all, cleanliness is in the eye of the maintainer.
    Exactly the sort of sentiment I would expect from a basement-troll. Or Nagesh.
    When are basement-trolls ever concerned about cleanliness? Your flamebait doesn't even make any sense.
  • Philipp (unregistered)

    Did anyone notice that he fills the array with 10 copies of the same randomly-generated value?

    So no matter how much you distrust the random number generator, shuffling the array and then selecting a random index is completely pointless, because all entries are identical anyway.

  • (cs) in reply to Philipp
    Philipp:
    Did anyone notice that he fills the array with 10 copies of the same randomly-generated value?

    So no matter how much you distrust the random number generator, shuffling the array and then selecting a random index is completely pointless, because all entries are identical anyway.

    Isn't Rnd a function?

  • (cs) in reply to redtetrahedron
    redtetrahedron:
    I also like how the Randomize function is called with a seed from Rnd... another level of randomization!
    Yes, except using an unseeded RNG to seed itself seems rather pointless.
  • Philipp (unregistered) in reply to Mike
    Mike:
    For 99% of what you are doing, the built in rand() functions of most languages are fine. If you are working in the 1%, you probably already know what you are doing and your code wont wind up here anyway.
    These only cases I could think of which fall into this one percent are:
    1. Anything where guessing the number could compromize security (generation of paswords, session-id's or cryptographic keys, for example)
    2. Creation of random sample data for a model used for research purpose (a bad pseudorandom number generator can introduce artifacts you can mistake for significant patterns proven by your model)
  • Chuck Lester (unregistered) in reply to Dima Polovinkin
    Dima Polovinkin:
    Why didn't he shuffle it random number of times?

    To ensure deterministic response time, I guess this is part of a real time application.

    Captcha: plaga, spanish for plague, just as VB programs

  • Hortical (unregistered) in reply to frits
    frits:
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

    Take a look at "God's Creation". It's covered with dirt! And its inhabitants shit everywhere!

  • ac (unregistered) in reply to ted
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd. It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    You probably still use lmgtfy and think you're so damn clever.

    It means in real life, you're an unoriginal hipster doofus.

    Got anything to do with sanitizing inputs to a SQL database, etc.? Link to Bobby Tables. Got a nerd-project slow-ass turing machine? Like a minecraft logic circuit from redstone? Link to the one where it's some guy alone in the world making a computer out of rocks. Got a story about password security or encryption? Link to the one where they beat the password out of the guy with a wrench.

    Fuck off. You're not clever.

    someones not happy today..!

  • Hmmmmmpf... (unregistered) in reply to ted
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Wait... you knew it was xkcd even before clicking on the link? You're a genius! Was it "this XKCD comic" that gave it away, or the fact that the url is "xkcd.com"?

    Unless by "the link" you meant "the link to the comments page", and by "it" you meant "there was".

    ted:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    You probably still use lmgtfy and think you're so damn clever.

    It means in real life, you're an unoriginal hipster doofus.

    Got anything to do with sanitizing inputs to a SQL database, etc.? Link to Bobby Tables. Got a nerd-project slow-ass turing machine? Like a minecraft logic circuit from redstone? Link to the one where it's some guy alone in the world making a computer out of rocks. Got a story about password security or encryption? Link to the one where they beat the password out of the guy with a wrench.

    Fuck off. You're not clever.

    Woah dude, you don't find people as incredibly butthurt as you often. You should go to the xkcd forums and meet a guy called "SirMustapha", you'd become friends. I'd post a link, but I'm not sure if that would make me a hipster doofus.

    In fact I shouldn't have posted anything at all. Everyone who posts here thinks they're so damn clever to have discovered that you can write a comment. They probably use stuff like "GMail" or "Facebook" or "Windows" and think they're so fucking clever.

  • Nagesh (unregistered) in reply to boog
    boog:
    redtetrahedron:
    I also like how the Randomize function is called with a seed from Rnd... another level of randomization!
    Yes, except using an unseeded RNG to seed itself seems rather pointless.
    It is seme as caling rnd 2x and using 2nd one.
  • another unoriginal hipster doofus (unregistered) in reply to ted
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

  • (cs) in reply to Mike
    Mike:

    For 99% of what you are doing, the built in rand() functions of most languages are fine. If you are working in the 1%, you are probably trying to create your own encryption method from scratch because your data needs "more security". You should stop coding, back away from the keyboard slowly, and find another project to work on.

    //Captcha: praesent - is it Christmas already?

    FTFY

  • Philipp (unregistered)

    Well, at least this attempt at better randomness is "just" pointless and not doing the opposite of what it is supposed to do like in this article: http://thedailywtf.com/Articles/SuperRand.aspx

  • Tod (unregistered) in reply to Philipp
    Philipp:
    Well, at least this attempt at better randomness is "just" pointless and not doing the opposite of what it is supposed to do like in this article: http://thedailywtf.com/Articles/SuperRand.aspx
    Which had an xkcd reference too! Damn hipster weaboo fags with their lmgtfys and doofuheys.
  • Alex (unregistered) in reply to ted

    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/trolling.png

  • (cs)

    #OccupyTheDailyWTF then.

  • (cs) in reply to boog
    boog:
    redtetrahedron:
    I also like how the Randomize function is called with a seed from Rnd... another level of randomization!
    Yes, except using an unseeded RNG to seed itself seems rather pointless.

    Oh, go seed yourself.

  • (cs) in reply to Hortical
    Hortical:
    frits:
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

    Take a look at "God's Creation". It's covered with dirt! And its inhabitants shit everywhere!

    That's not God's fault. That's all the work of the devil. Thought that was obvious.

  • (cs) in reply to ac
    ted:
    I didn't even click on the link and knew it was some fag linking xkcd blah blah trolly trolly...
    ac:
    someones not happy today..!
    Hmmmmmpf...:
    Woah dude, you don't find people as incredibly butthurt as you often.
    another unoriginal hipster doofus:
    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?
    Hey, congrats on the troll there teddy-boy, looks like you got some good bites!
  • (cs) in reply to another unoriginal hipster doofus
    another unoriginal hipster doofus:
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

    Cool down, fellows. This is an old "meme" which someone gets out and dusts down whenever xkcd is invoked. It catches loads of people.

  • Not Ted (unregistered) in reply to ted

    Hmm..let's see here..violent overreaction.. homophobic slurs.. use of "hipster" without knowing what it even means.. unnecessary profanity.. ah, I get it. You're on the wrong web site. Slashdot is the next one down in your bookmarks. Try that one next time.

  • ted (unregistered) in reply to QJo
    QJo:
    another unoriginal hipster doofus:
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

    Cool down, fellows. This is an old "meme" which someone gets out and dusts down whenever xkcd is invoked. It catches loads of people.

    f- you. What makes you think I'm not dead damn serious? It's a retarded practice and it needs to stop!

  • Bob (unregistered) in reply to ted
    ted:
    QJo:
    another unoriginal hipster doofus:
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

    Cool down, fellows. This is an old "meme" which someone gets out and dusts down whenever xkcd is invoked. It catches loads of people.

    f- you. What makes you think I'm not dead damn serious? It's a retarded practice and it needs to stop!

    Please attempt some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

  • (cs) in reply to QJo
    QJo:
    Hortical:
    frits:
    DonaldK:
    Cleanliness is close to godliness.
    This statement appears nowhere in the bible.

    I'd be willing to bet the myth that this is a biblical proverb has its roots in the large scale marketing of soaps by companies like Unilever, P&G, and J&J during the industrial revolution. Or something.

    Take a look at "God's Creation". It's covered with dirt! And its inhabitants shit everywhere!

    That's not God's fault. That's all the work of the devil. Thought that was obvious.

    Just like having to wipe your ass! If it was purely God's work, and he designed us intelligently, he'd make us dispose our waste without any "restants" that need to be cleaned up.

    Same thing goes for evolution, really. If evolution were true, how come we haven't evolved to not having to wipe our ass?

    Big, toothy animal: "I smell shit! Someone must be around!" Smart-ass at stinky shitbutt: "If only you could shit cleanly!"

  • (cs) in reply to Bob
    Bob:
    ted:
    QJo:
    another unoriginal hipster doofus:
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

    Cool down, fellows. This is an old "meme" which someone gets out and dusts down whenever xkcd is invoked. It catches loads of people.

    f- you. What makes you think I'm not dead damn serious? It's a retarded practice and it needs to stop!

    Please attempt some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    Fuck off, Bob.

  • (cs) in reply to trtrwtf
    trtrwtf:
    Bob:
    ted:
    QJo:
    another unoriginal hipster doofus:
    ted:
    renewest:
    Reminds me of this XKCD comic:

    http://imgs.xkcd.com/comics/random_number.png

    I didn't even click on the link and knew it was some fag linking xkcd.

    Yes, well done. It's not like he explicitly said "Reminds me of this XKCD comic". You must be very proud of that deduction.

    test:
    It's not clever. It's not funny. Just the word "random_number" with a link under it and the short, useless, one sentence post shows the kind of unoriginal, uninspired, idiot is making the post.

    It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd.

    Did you consider that perhaps it was intended not for you, but for people who have yet to read that particular xkcd comic?

    I'm surprised that such a simple statement ("this reminds me of ...") would provoke such vitriol. Maybe avoiding the comments section altogether would make you happier.

    Cool down, fellows. This is an old "meme" which someone gets out and dusts down whenever xkcd is invoked. It catches loads of people.

    f- you. What makes you think I'm not dead damn serious? It's a retarded practice and it needs to stop!

    Please attempt some sensitivity. I had a son who was retarded, and let me assure you: it is no laughing matter.

    Fuck off, Bob.

    Whee! It's like watching a drunkard fall downstairs. You know it's going to happen as soon as the cat winds itself between his legs, and from that very first moment of teeter, you can predict practically the entire process.

Leave a comment on “Random Char and Triply-Random Double”

Log In or post as a guest

Replying to comment #:

« Return to Article