Latest revision |
Your text |
Line 6: |
Line 6: |
| | titletext = <nowiki>RFC 1149.5</nowiki> specifies 4 as the standard IEEE-vetted random number. | | | titletext = <nowiki>RFC 1149.5</nowiki> specifies 4 as the standard IEEE-vetted random number. |
| }} | | }} |
| + | |
| ==Explanation== | | ==Explanation== |
− | The comic specifies a function (in a {{w|C (programming language)|C}} similar syntax), which judging by its name should be designed to return a random number. Most functions of this form are random number ''generators'', meaning that on subsequent calls they return ''different'' random numbers. But the programmer has instead implemented a function that just returns the ''same'' random number each time, which, while it could indeed have been truly randomly chosen by rolling a die as the [[156: Commented|comment]] documented, is essentially worthless were it ever to be called more than once (with the expectation of different, i.e., random, results). In other words, the results over time would not be random at all, but completely predictable and deterministic. | + | The comic specifies a function (in a {{w|C (programming language)|C-like}} syntax, perhaps {{w|C++}}) that, when called, returns a random number. Most functions of this form are random number ''generators'', implying that they return many ''different'' random numbers. Here, the programmer has instead created a function that just returns a ''single'' random number - one chosen by rolling a die. This function is essentially worthless, as it could simply be replaced by a "4" wherever it is used. (In fact, most modern compilers would do this automatically.) |
− | | |
− | Alternatively, this could be seen as making fun of how people normally will erroneously think of "random numbers". A mathematician will (or at least should) think about a random number as one that is independent of something (usually being independent of the next number in a list of numbers). However a normal person will often think of a list of random numbers as just meaning it having "no pattern". This difference is described in [https://simple.wikipedia.org/wiki/Hacker_koan#Uncarved_block an MIT koan]. (Just to drive this point home, if the first number of a list is "4", and the second number is independent of the first, then that means the second number can also be "4" (as well as the 3rd and 4th). This obviously creates a "pattern", while still being random because of the independence)
| |
− | | |
− | The {{w|IEEE}} is the organization responsible for maintaining a number of computer standards. An RFC, or {{w|Request for Comments}}, is a formal document put out to computing experts by {{w|IETF}} in the hopes of becoming a future standard. However, RFC 1149 was an {{w|April Fools' Day Request for Comments|April Fools' joke}}, defining how carrier pigeons can be used to transmit Internet packets. "<nowiki>RFC 1149.5</nowiki>," meanwhile, simply does not exist.
| |
− | | |
− | ==Trivia==
| |
| | | |
− | * The well-known "helper website" ([http://gChq.github.io/CyberChef/#recipe=XKCD_Random_Number() CyberChef]) has a function that simulates XKCD's program.
| + | The {{w|IEEE}} is the company responsible for maintaining a number of computer standards. An RFC, or {{w|Request for Comments}}, is a formal document put out to computing experts in the hopes of becoming a future standard. However, RFC 1149 was an April Fool's joke, suggesting that carrier pigeons be used to transmit Internet packets. There is no <nowiki>RFC 1149.5</nowiki>. |
− | * Esolangs.org features a [http://esolangs.org/wiki/user:XKCD_Random_Number challenge] that requires you to rewrite the program in XKCD's comic in another programming language, as either a function or a full program that prints the "4".
| |
| | | |
| ==Transcript== | | ==Transcript== |
− | [A computer program.]
| |
| int getRandomNumber() | | int getRandomNumber() |
| { | | { |
− | return 4; // chosen by fair dice roll.
| + | return 4; //chosen by fair dice roll. |
− | // guaranteed to be random.
| + | //guaranteed to be random. |
| } | | } |
| | | |
| {{comic discussion}} | | {{comic discussion}} |
| [[Category:Programming]] | | [[Category:Programming]] |
− | [[Category:Computers]]
| |
− | [[Category:Comics with lowercase text]]
| |