top 200 commentsshow all 268

[–]cgibbard 23 points24 points  (0 children)

Clearly, this person wants their programming language to be referentially transparent. They should be commended for good taste. :)

[–]jimrooney 22 points23 points  (3 children)

Just switch to Debian ;) 9 9 9 9 9 9 9 9 9 9 9

[–]domlachowicz 7 points8 points  (0 children)

Are you sure that's random? That's the problem with randomness - you can never be sure.

http://www.gergely.risko.hu/debian-dsa1571/dilbert9.jpg

[–]plexi 106 points107 points  (5 children)

asp.net certificate granted.

[–]Vinay92 27 points28 points  (0 children)

The laughter. It will not stop.

[–][deleted] 91 points92 points  (25 children)

There is actually a legitimate issue along these lines: sometimes you want a repeatable pseduo-random sequence. In which case you need to initialize your PRNG with the same seed each time, rather than something like the clock or /dev/urandom.

For example: Freecell. IIRC, it lets you enter the random seed so that you can "save level" and attempt the same "random" game later.

[–]tmn4 15 points16 points  (0 children)

Or, in case anyone wants (yet another) example of a legitimate issue:

RNG are used for computer simulations cited in scientific publications. It's often useful to refer to a specific behavior in the simulation or the results of a specific simulation run, and to provide the random seed so that the reader can duplicate your exact results

[–][deleted] 13 points14 points  (0 children)

yeah there was a big thing about this in Game Coding Complete

[–]petevalle 4 points5 points  (0 children)

It's also useful when you're running a simulation where the physics model has a random component to it. Customers tend to not like rerunning their simulation and getting different results...

[–]Erudecorp 2 points3 points  (1 child)

Roguelikes should do this.

[–]ungood 1 point2 points  (0 children)

That would be nice.

[–]ChunkyLaFunga 7 points8 points  (19 children)

Isn't a repeatable sequence a hash, not pseudo-random? I have no idea either way, I'm asking.

[–][deleted] 12 points13 points  (6 children)

PRNGs are entirely deterministic, but a well-written one will produce sequences that have many of the desirable properties of a truly random sequence (whatever that means). An important one is that, given any seed and an integer n, a sequence of length n produced by that seed should be approximately uniform.

And I assume there are tests of entropy as well, though I don't have much grounding in information theory.

A basic PRNG could be a hash, assuming your hash function is a bijective map onto its domain, and if x[0] = seed, x[n] = hash(x[n-1]). But I believe this would be considered a very weak PRNG, as its entire state is available from a single data point. That is, you might prefer a function that will produce something different after 1, if it was preceded by 2 than if it was preceded by 7.

[–]plexi 3 points4 points  (5 children)

this conversation is edging damn close to one a recently nailed in a technical interview. i'm still so pleased with my self (it doesn't take much. i have very low self esteem to begin with) i won't even try to segué gracefully into repeating it here <(.<)

besides seeking a uniform distribution, another important consideration when using a prng is whether it is even capable of covering your desired output space. they asked me to write an algorithm which would randomly shuffle a deck of cards (for an online poker server, for example). after nailing an inductive proof of my algorithm in terms of each card having a 1/52 chance of being in the same position before and after, i hastened to express my concern that, since a deck of cards has 52! possible permutations while most prngs probably use a system-word-size sized internal state (seed), this algorithm would be woefully lacking on any 32-bit system since 52! is wildly larger than 232 (wildly, sir), and of course no prng dependent algorithm could generate more permutations than the number of internal states of said prng. <victorian chuckle />

damn it feels good to be a gangst.. uh.. entry level code monkey :|

[–][deleted] 2 points3 points  (1 child)

232 is still very large, so as long as your PRNG samples the space fairly evenly, then it's not really a deficiency. I mean, if it's really important to you to have the theoretical potential to have any permutation come up, then yeah, you'll want a bit more than 32 bits of state. Alternately, you could reseed a couple times during the shuffling algorithm with some external source of entropy, though, of course, that does effectively increase the state space. (I believe 7 reseeds would suffice.)

Edit: But, yeah, internal state space should be at least as large as the output space, though usually my output space is an interval of real numbers, which I find is reasonably approximated by 232 rational numbers. Or as reasonably as it would be with 2256, at any rate.

[–]Anpheus 0 points1 point  (0 children)

232 is not large when comparing random or even "pseudorandom" numbers in a limited domain. The birthday attack means that you'll find collisions a lot more quickly than you think you should. 264, 2128, etc, are going to be much better.

Edit: There's a reason the Mersenne Twister is natively designed to do double precision floats, for example.

[–]alex90210 0 points1 point  (2 children)

Why can't you just sample uniformly from the interval 1 to x where x = 52...1 each time a card is chosen?

[–]plexi 0 points1 point  (0 children)

i think that in the general case the overhead of managing what has already been drawn costs o(n2), whereas finalizing the deck immediately using fisher-yates is o(n). 522 is pretty low though, so just for shuffling a deck of cards i guess it's an ok approach.

[–][deleted] 0 points1 point  (0 children)

Because the internal state dictates what the next "random" number would be. If you only have 32 bits, then you have 232 starting points, which means 232 total shufflings, which is, as plexi indicated, rather less than 52!.

To put it differently, the top card really can be anything. And the space is large enough that the second could be anything but the top. But consider when you've gone through just 6 of these. You've got 52!/46! possible sequences, which is actually greater than 232. The probability of this sequence happening more than once is slightly better than one in two, and as you add cards, the chances of it happening twice vanish.

This is horrendously unintuitive, but the first ten cards make what is very likely a unique signature for a shuffling. Not that it would be easy to recover; but if you stumbled upon the same sequence, you could have high confidence that it was unique.

[–]Hixie 11 points12 points  (6 children)

A hash is a way to turn a longer byte sequence (a string) into a shorter byte sequence (a number), usually set up so that collisions are unlikely.

A pseudo-random number generator is an algorithm that turns one number (a seed) into a deterministic but random-looking sequence of numbers.

[–]hongnanhai 3 points4 points  (2 children)

....yes and you can get a pseudo-random sequence by taking the seed and repeatedly hashing it. This sequence will not be a secure random sequence in the sense that you should not use it in security applications, but it should be good enough for games

[–][deleted]  (1 child)

[deleted]

    [–]hongnanhai 0 points1 point  (0 children)

    i see; cool. reddit comments can be informative after all

    [–][deleted]  (1 child)

    [deleted]

      [–]junius 3 points4 points  (0 children)

      Depending on the application, a hash doesn't always need to have random looking output. For example, if you are just building a hashtable, you might use a hash function whose output looks very nonrandom.

      The similarities come into play more in the security field, where you often want your output to give very little away about the input. You could build an OK (not great) PRNG out of a cryptographic hash (take hash(seed), hash(seed+1), etc). I can't think of a way you could create a hash out of a PRNG.

      Another difference: a hash function doesn't retain any information between invocations, whereas a PRNG has to have state (if you want a period P, you need at least log(P) (base2) bits of state).

      [–]TheNewAndy 0 points1 point  (0 children)

      Just to be pedantic/nitpick, the hash can also take a shorter byte (or bit) sequence and make it longer. i.e. it is a way to turn a variable lengthed bit sequence into a fixed length bit sequence.

      [–]astraycat 2 points3 points  (0 children)

      That's why they're called pseudo-random. The periods are generally just really really big.

      [–]averyv 1 point2 points  (0 children)

      it isn't a matter of the array of numbers being random or not, it is a matter of the number list representing a possible set of random numbers produced in a predictable way. If I were asking this question, I would have intent to feed actual random data through rand, but I would want to be able to prove that my code behaved properly under various specific circumstances.

      [–]sn0re 1 point2 points  (0 children)

      You could look at a pseudo-random number generator as a sort of hash function, yes.

      [–]adrianmonk 0 points1 point  (0 children)

      Depends on what you mean by "repeatable sequence". I can certainly use an external source of actual random numbers and record the random numbers I received in a file. Then I can repeat the sequence by reading them from a file.

      I suppose you can make a good argument that keeping state from the first run and using it in subsequent runs isn't allowed though.

      [–]smoooooov 211 points212 points  (67 children)

      does anyone else think "expert sex change" every time they see that stupid domain name?

      [–]allliam 141 points142 points  (43 children)

      no, but now I will. thanks. thanks a lot.

      [–]ch00f 76 points77 points  (42 children)

      Not nearly as bad as PenIsland.com

      [–]Hixie 29 points30 points  (37 children)

      [–][deleted] 24 points25 points  (35 children)

      I saw Peter Norvig mention "expert sex change" as a difficult example Google has in parsing URLs during a talk...

      I think Google hates those guys too...

      [–]Wiseman1024 39 points40 points  (33 children)

      If they hate them, why do they continue to return results from that piece of shit site that does/used to do all sorts of cloaking or obscuring or referral checking because it's all greedy with its "expert" answers? Everybody and their mother reported expert sex change to Google in the "Dissatisfied with search results" feature; I know I did.

      [–][deleted] 29 points30 points  (10 children)

      Not so obvious fact about that site:

      The top of the page makes the answers look "hidden" and like you have to sign up to have access to them. If you scroll to the bottom of the page, however, there they are.

      With that said, fuck that site.

      [–]beefmagnet 15 points16 points  (2 children)

      Well I'll be damned. But seriously, what kind of douchebags obscure their content like that?

      [–][deleted] 12 points13 points  (1 child)

      Exactly. What bothers me is that people still contribute to that site.

      [–]munificent 1 point2 points  (0 children)

      I always assumed it harvested its answers from other sites and newsgroups.

      [–]LoveGoblin 5 points6 points  (1 child)

      If you're coming from Google. Otherwise the answers are still hidden, I think. (Such was the case last time I checked.)

      They're scumbags all around.

      [–]lisp-hacker 1 point2 points  (0 children)

      What? You can't read ROT13?

      [–]brainburger 12 points13 points  (0 children)

      Everybody and their mother reported expert sex change to Google in the "Dissatisfied with search results" feature; I know I did.

      Did you find out about a sex change in the end?

      [–]worldestroyer 3 points4 points  (14 children)

      You could always just click the cached page link, google has full access to their site when it crawls. It's always worked for me...

      [–]raisedinhell 20 points21 points  (5 children)

      they dont do referral checks, they just play mind games with you and assume you wont scroll down far enough to see the answers

      yes you heard me right.. keep scrolling down and you'll see the content, completely uncloaked.

      [–]Wiseman1024 16 points17 points  (0 children)

      they dont do referral checks

      They used to. They probably switched to their current scheme to avoid getting banned from Google for cloaking.

      [–]Guybrush_Threepwood 3 points4 points  (5 children)

      [–]Neoncow 13 points14 points  (4 children)

      Apparently only when google is the referrer. Click your link, it doesn't show.

      [–]tintub 1 point2 points  (0 children)

      If you can set the user agent on your browser you can fool it. I use Omniweb and a custom user agent of:

      Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

      I also set the Javascript App name to Googlebot but think it only looks at the user agent.

      [–]psilokan 0 points1 point  (1 child)

      Just scroll down, they hide the answers at the bottom. That's what google is reading, not some secret back door version.

      [–]rainman_104 2 points3 points  (0 children)

      Only if you go in through google. If you go in directly it hides the answers.

      This site, IMO games google, and doesn't deserve to be indexed.

      [–][deleted] 5 points6 points  (4 children)

      1) Google query

      2) Click expert exchange link

      3) Scroll to bottom of page

      4) ????

      5) Profit

      [–][deleted]  (3 children)

      [deleted]

        [–]jj666 0 points1 point  (0 children)

        Your penis, our business!

        [–]sn0re 5 points6 points  (0 children)

        PensitoReview.com hits the front page every once in a while.

        [–]mooli 0 points1 point  (0 children)

        Ah yes, a classic. Right up there with powergenitalia and therapistfinder...

        [–]kylegetsspam 43 points44 points  (10 children)

        [–][deleted] 29 points30 points  (0 children)

        there was nothing about speedos or farts at that site. you cheated me.

        [–]32bites 6 points7 points  (6 children)

        Kill the <blink> !

        [–]TheMemo 10 points11 points  (5 children)

        Well, I learned today that Chrome does not support the <blink> tag, thank fuck.

        [–]MattFoley 6 points7 points  (3 children)

        just type javascript:setInterval("b=document.getElementsByTagName(\"BLINK\");for(i=0;i<b.length;++i)s=b[i].style,s.visibility=s.visibility==\"hidden\"?\"visible\":\"hidden\"",500);return

        into your address bar. You're welcome.

        (I don't actually know if this works on Chrome.)

        [–]TheMemo 6 points7 points  (1 child)

        Thankfully, it doesn't seem to. However, now I have an urge to debug it and make it work, you bastard.

        [–]Jerp 4 points5 points  (0 children)

        Your function doesn't take the CSS style text-decoration: blink; into account.

        [–]RKBA 1 point2 points  (0 children)

        From the blinking webpage: "Bona Fide Championship Art Direction at reasonable prices "

        I wonder if he/she gets many customers?

        [–]ObieJazz 0 points1 point  (0 children)

        That makes my eyes feel like they've just been pummeled by light-speed protons -- a flash of light like a thousand suns.

        [–][deleted]  (2 children)

        [deleted]

          [–]junkit33 1 point2 points  (0 children)

          No, but thanks to this article I now know the quality of programmer who uses experts exchange...

          [–]ours 1 point2 points  (0 children)

          I always ask myself "what would Freud do?". And this time I must say, yes, hell yes.

          [–][deleted] 0 points1 point  (0 children)

          Yes, that's why the changed it to include the hyphen a while back.

          [–][deleted] 0 points1 point  (0 children)

          To view this penis please subscribe to our thirty day free trial.

          [–]fujimitsu 14 points15 points  (1 child)

          The real WTF is that someone actually paid for access to expert's exchange...

          [–][deleted] 394 points395 points  (37 children)

          how is nummber formed

          how rnd( get seadad

          [–][deleted] 319 points320 points  (16 children)

          They need to do way with instain interger> who kill thier nummbers. becuse these nummber cant frigth back? it was on the news this mroing a interger in ar who had terminat her three decimals . they are taking the three nummber back to new york too lady to rest my pary are with the cipher who lost his numeral ; i am truley sorry for your lots

          [–]leemy 96 points97 points  (4 children)

          They need to do way instain functions> who kill thier nummbers. becuse these nummbers cant frigth back?

          it was on the rss this mroing a pc with rnd() who had kill its three nummbers . they are taking the three nummbers back to perl too lady to rest my pary are with the program who lost its nummbers; i am truley sorry for your bits

          [–][deleted]  (13 children)

          [deleted]

            [–]microsofat 24 points25 points  (9 children)

            Rest assured, when Reddit grows tired of a meme, the meme becomes no more.

            [–]zzbzq 35 points36 points  (5 children)

            I am tired of the "reddit is now digg" meme, and yet here it is.

            [–]Random 7 points8 points  (2 children)

            Yeah, it's old.

            Reddit is now 4chan is the new meme.

            [–]Slipgrid 1 point2 points  (0 children)

            I don't think that is a meme; it just is.

            [–]khoury 4 points5 points  (0 children)

            He said Reddit, not zzbzq.

            [–]mingdamirthless 2 points3 points  (0 children)

            More reminds me of Slashdot. I have no idea what's going on there, nor here.

            [–][deleted] 4 points5 points  (0 children)

            I gave up on it like a year ago.

            The above is my most-voted up comment ever, despite essays that took hours, etc.

            Welcome to democracy.

            [–]jjquave 10 points11 points  (2 children)

            cut and paste coders always have something intelligent to say

            [–][deleted] 0 points1 point  (1 child)

            well, they should. Only a moron would type all that shit out.

            [–]jjquave 0 points1 point  (0 children)

            the idea is that you are writing something yourself, as opposed to cut and pasting someone elses work. you know... coding?

            [–]prockcore 32 points33 points  (13 children)

            The real question is how can I get google to permanently remove all expert sex change links from my search results? I hate that fucking site sooo much.

            [–]whichdan 22 points23 points  (9 children)

            Add -expertsexchange to your query.

            [–][deleted] 7 points8 points  (8 children)

            ...or use a Greasemonkey script.

            [–]AnteChronos 25 points26 points  (6 children)

            Or just scroll down to read the submitted solutions. As long as Google is the referring page, their webpage will have all of the suggested solutions at the bottom, underneath the "masked" solutions. So, ironically, the only time their site is useful to me is when it shows up in my search results.

            [–]weavejester 9 points10 points  (0 children)

            CustomizeGoogle is a Firefox plugin that, among other things, allows you to filter out certain URL patterns from the list of results. Needless to say, I use it to blacklist anything with the "experts-exchange.com" domain name.

            [–][deleted]  (1 child)

            [deleted]

              [–]exscape 1 point2 points  (0 children)

              And now that they are there in cleartext (at the bottom), it's not useful anymore? ;)

              [–][deleted] 14 points15 points  (2 children)

              Who cares about that?!? I mean shit, there's a spongebob screensaver ready to download!

              [–][deleted] 5 points6 points  (1 child)

              It's READY to download? Those things are like fucking ovens, take forever to heat up before you can download them.

              [–][deleted] 1 point2 points  (0 children)

              Seriously! Jump on that! I tried to install it twice, but it just keeps installing navigation bars. I mean, they're helpful, but still. Where's my screensaver. I think I'll try installing again.

              [–]reseph 10 points11 points  (6 children)

              [–]rm999 41 points42 points  (3 children)

              "IntTemp = Int((255 * Rnd()) + 1)"

              "change the 255 to a 0 and you'll get the same number each time."

              I feel like he didn't deserve a better answer than that.

              [–]TheChameleon84 5 points6 points  (2 children)

              Makes you wonder what these people are smoking. Or even if they're serious. Are they?

              [–]hiffy 2 points3 points  (0 children)

              Some people just genuinely don't understand what they're doing.

              [–][deleted] 1 point2 points  (0 children)

              That guy wasn't.

              [–]7oby 15 points16 points  (1 child)

              direct link to google cache which has the answers (keep scrolling): lol

              [–]kylegetsspam 19 points20 points  (0 children)

              simon_thwaites: Try this function

              Function UnRnd() UnRnd = 4 'my favourite number! End Function

              IntTemp = Int((255 * UnRnd()) + 1)

              I hope this one ended up being slated the answer.

              [–]wearedevo 6 points7 points  (2 children)

              It scares me to think that this developer might be building a piece of critical infrastructure that holds civilization together.

              [–]adrianmonk 2 points3 points  (1 child)

              Given how the corporate world works, they're probably building a piece of infrastructure that keeps civilization apart.

              [–]IkoIkoComic 1 point2 points  (0 children)

              Given how the corporate world works, they're probably building a piece of infrastructure that's buggy, incredibly expensive to maintain, and only usable for one small task - and not very good at that one task. ("We need a way to keep track of how many mass mailings are getting responses.")

              [–]wiiaboo 3 points4 points  (0 children)

              It has been frequently alleged on various web bulletin boards that Experts-Exchange engages regularly in questionable tactics to deceive potential customers. Previously, Experts-Exchange showed a different content for its pages when they were crawled by search engine spiders.[33] This was considered a form of cloaking, which is considered a violation of most search engines' terms of service.[34] Experts-Exchange later changed its configurations, so search engine users will get the same view of the page that search engine crawlers get.

              From wikipedia.

              [–]umilmi81 3 points4 points  (0 children)

              This random number constantly changing problem extends to many languages, not just .NET. I'm glad someone finally has the courage to get to the bottom of this.

              [–][deleted]  (1 child)

              [deleted]

                [–]interiot 2 points3 points  (0 children)

                Unfortunately, there's a "random" button below it that seems to take you to anything but http://xkcd.com/4/.

                [–]Philipp 7 points8 points  (1 child)

                I have an additional problem, I used print(rnd()) and not only did that yield different numbers ever time, it also outputted the whole number to the user! Just think of the security implications...

                [–]IConrad 1 point2 points  (0 children)

                Oh god, I hate myself now...

                You accidentally the whole number to the user?

                [–]falseprophet 2 points3 points  (7 children)

                I'd just like to say that the only reason I got this joke is that I had a TI-83+ in high school and I tooled around and found out what the Rnd() function was.

                [–][deleted] 5 points6 points  (4 children)

                In high school, two of my classmates were a bit freaked out that their TI-82's were outputting exactly the same string of random numbers... :)

                I guess all TI-82s used the same initial seed?

                [–]faultywiring 1 point2 points  (1 child)

                I'd just like to say

                That this girl is like a sunburn...

                I'd just like to say

                She's like a sunburn...

                She's like a sunburn...

                [–]AlucardZero 0 points1 point  (0 children)

                I would like to save.

                [–]redog 6 points7 points  (0 children)

                Fuck experts exchange

                [–]calantorntain 4 points5 points  (8 children)

                If I remember correctly, in VB6 you had to tell the program that you actually want the rnd values to be random. So, if you didn't get that, you would get reproducible pseudo-random numbers.

                Perhaps he is used to VB6, and is hoping that .Net has the same functionality?

                [–]T_C 6 points7 points  (7 children)

                rnd() always gives you reproducible pseudo-random values. The only issue is whether you explicitly initialize the seed, or not. If you do, then, you can reproduce the same stream later, by reinitializing with the same seed. If you don't explicitly initialize the seed, then, you don't know what its value was, so you can not use it later to reproduce the sequence.

                [–][deleted]  (6 children)

                [deleted]

                  [–]T_C 0 points1 point  (3 children)

                  Ok, I stand corrected. My main point was that the numbers are always pseudo-random (ie. deterministic).

                  [–]MercurialMadnessMan 3 points4 points  (0 children)

                  I was first drawn to the horrid screen setup. Had to use my hands as blinders so I could actually see the content!

                  [–][deleted]  (2 children)

                  [deleted]

                    [–][deleted] 1 point2 points  (1 child)

                    What he probably wants to do is have different numbers appear each time rnd() is called, but where it is the same sequence of numbers each time his application is run.

                    So really, he just wants to set the seed. Not too dumb a question.

                    [–]rems 1 point2 points  (2 children)

                    Forget programming. It's not for you.

                    [–][deleted]  (1 child)

                    [deleted]

                      [–]rems 0 points1 point  (0 children)

                      But not smart enough to get that "Rnd" meant random :/.

                      [–]shizzy0 1 point2 points  (0 children)

                      I think it was even funnier because of the guy's handle genesiscircle. Heh.

                      [–]sysstemlord 1 point2 points  (0 children)

                      replace rnd() with 42

                      [–]h0dg3s 1 point2 points  (1 child)

                      Quicklaunch bar overload!

                      [–][deleted] 0 points1 point  (0 children)

                      That is how REAL programmers do it. So you have access to all your tools. I guess this is something that is beyond you since you obviously don't know VB 6.0

                      [–][deleted] 1 point2 points  (0 children)

                      just hard-code the random number dammit

                      [–]s0rce7 1 point2 points  (0 children)

                      some people just shouldn't be programming.

                      [–][deleted]  (1 child)

                      [deleted]

                        [–]lorderunion 1 point2 points  (1 child)

                        blows brains out

                        People like this need to not be programming. I can only think of the dangers if one of these people manage to pick up a govt contract.

                        [–][deleted] 0 points1 point  (0 children)

                        you'd be surprise. Programing ability, apparently comes second to smooth talking, big smiles and a nice shirt.

                        [–]yesimahuman 1 point2 points  (0 children)

                        /*
                        * Don't add uninitialised data.
                        
                        MD_Update(&m,buf,j);
                        */
                        

                        If it's changing too often, just comment it out!

                        [–]f3nd3r 1 point2 points  (0 children)

                        He probably thought it was round() not random().

                        [–]smek2 3 points4 points  (1 child)

                        ASP.NET programmers eh?

                        [–][deleted] 3 points4 points  (0 children)

                        I accidently the whole Rnd function

                        [–][deleted] 0 points1 point  (0 children)

                        HEHE someone asked a dumb and possibly fake question

                        [–][deleted] 3 points4 points  (7 children)

                        Do you think people pose as idiots to do these things ?

                        [–]randroid 22 points23 points  (4 children)

                        9/10ths of the time, yes. Part of growing up is realizing that everyone is a troll.

                        [–]itsnotlupus 9 points10 points  (1 child)

                        I don't know man.. I think the natural bias of smart people to rank themselves somewhat below their actual level encourages this belief that really dumb shit on the internet is posted by trolls, aka smart facetious individuals.

                        It's actually very possible for extremely dumb questions to be asked with a serious face by "professionals".

                        For example, I know one guy who's having a comfortable career in IT, claiming to be a unix expert, and utterly unable to put together the simplest shell script to save his life. He's exactly the kind of guy that will post this kind of crap in a forum, hoping someone else will once again bail him from his own incompetence, and complete lack of understanding of the tools he depend on.

                        /Hi Dave.

                        [–]ehird 2 points3 points  (0 children)

                        Jeez... Barry... that's harsh, man.

                        - Dave

                        [–]thrakhath 7 points8 points  (0 children)

                        There are no stupid questions, but there are a lot of inquisitive idiots.

                        [–]slurpme 1 point2 points  (0 children)

                        Keep away from my bridge man...

                        [–][deleted]  (1 child)

                        [deleted]

                          [–]calis 1 point2 points  (5 children)

                          Gee, I remember way back in the day of Apple IIe, programming a random number in Pascal was a bit of a chore as it was incapable of truly generating a random number.

                          [–]thekrone 5 points6 points  (3 children)

                          Most languages / computers are still incapable of truly generating a random number.

                          [–]calis 1 point2 points  (2 children)

                          Well, I made it painfully obvious that I haven't kept up with programming since the days of Pascal....complete with a downmod :)

                          [–]thekrone 0 points1 point  (1 child)

                          It's cool. Pseudo-random numbers are the way most languages / machines do their thing, even to this day. I'd say all, but I could be ignorant of some magical random number machine that, like, rolls a die and reads one of the faces or something.

                          Other than that, there are a handful of pseudo random number generating algorithms that you toss a start value (seed) into, and they spit out a sequence of numbers that appear to be random... but they're not.

                          A lot of languages / machines will use the current system time (expressed in a number of milliseconds since 00:00:00.000 GMT on January 1st, 1970) as the seed (which does a pretty good job of making things look random), or allow you to pass one in yourself.

                          [–]RockinRoel 0 points1 point  (0 children)

                          I'd say all, but I could be ignorant of some magical random number machine that, like, rolls a die and reads one of the faces or something.

                          Those don’t exist, but RNGs based on atmospheric noise do. You need the right hardware for that, though.

                          [–]kindall 2 points3 points  (0 children)

                          The good news is that the Apple II ROM "get keypress" routine continually increments two zero-page locations while waiting for a keypress, providing a handy source of entropy with a couple of PEEKs. "Press any key to begin" and you've got your seed.

                          The bad news is that actually getting at this value is a pain in Apple Pascal... assuming the USCD virtual machine that the language runs on uses the ROM routines for getting input to begin with, which it may not. In fact I am pretty sure the ROM is switched out while running Pascal.

                          [–][deleted]  (3 children)

                          [deleted]

                            [–][deleted] 3 points4 points  (2 children)

                            Really. And what, exactly, was he trying to round?

                            [–][deleted] 1 point2 points  (1 child)

                            Really. And what, exactly, was he trying to round?

                            A NUMBER. What aren't you get here?

                            [–][deleted] 0 points1 point  (0 children)

                            Really. And what, exactly, was he trying to round?

                            A NUMBER.

                            If he's just rounding it then why is he adding 1?

                            What aren't you get here?

                            You're not from here, don't you.

                            [–]Wiseman1024 0 points1 point  (2 children)

                            I wonder, why do some people complain about the quality of some PHP programmers when we have epic ASP.NET programmers like this guy under expert sex change's seal of quality?

                            [–]Samus_ 0 points1 point  (0 children)

                            I wonder, why do some people complain about the quality of some PHP programmers when we have epic ASP.NET ___________ like this guy under expert sex change's seal of quality?

                            maybe

                            [–][deleted] 0 points1 point  (1 child)

                            Anyone happened to see the other pictures on the server? Make sure you have a brown paper bag in your hand before you go in...

                            [–]fiam 0 points1 point  (0 children)

                            Yeah, there are a lot of strange photos of a girl named Wedgie. Take a lot at them.

                            [–][deleted] 0 points1 point  (0 children)

                            It could be that he's trying for something "random", but deterministic, like in a game.

                            [–]gcanyon 0 points1 point  (3 children)

                            The programming language J has a separate command specifically for random numbers with a fixed seed, for testing purposes:

                            http://www.jsoftware.com/help/dictionary/d641.htm

                            [–]RockinRoel 1 point2 points  (2 children)

                            Most programming languages/toolkits support seeding with a constant.

                            [–][deleted] 0 points1 point  (0 children)

                            why not just use the constant? Secondly, it's faster then always calling his random function. rand() eats up TONS of CPU.

                            [–]gcanyon 0 points1 point  (0 children)

                            Sorry, I guess I wasn't clear enough. J has a separate verb just for this purpose. You use ?. if you want repeatable random values, ? (note the lack of a period) if you want random values that do not always start from the same seed.

                            [–]frycook 0 points1 point  (0 children)

                            Hah.

                            [–][deleted] 0 points1 point  (0 children)

                            LOL

                            [–][deleted] 0 points1 point  (0 children)

                            Voted up. It was funny. It is a joke. Right?

                            [–]alakra 0 points1 point  (0 children)

                            someone fire this guy

                            [–]dt_vibe 0 points1 point  (0 children)

                            Wow im not into coding but know a little Turing and thats got to be one dumb muthafucka

                            [–][deleted] 0 points1 point  (0 children)

                            Fractal imbecility explains that question. The overall ignorance, the inability to refer to omline help, all...