Editing 221: Random Number
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
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}} | + | 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 a range of ''different'' random numbers. Here, the programmer has instead created a function that just returns a ''single'' "random" number - one that the comment claims is 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.) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | The {{w|IEEE}} is the <s>company</s> 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}}, suggesting that carrier pigeons be used to transmit Internet packets. (Ironically, although the RFC was written in 1990, a homing pigeon with a couple microSD cards tied to its leg might well be faster than your typical consumer Internet connection in the US today.) There is no <nowiki>RFC 1149.5</nowiki>. | |
− | |||
==Transcript== | ==Transcript== | ||
− | |||
int getRandomNumber() | int getRandomNumber() | ||
{ | { | ||
− | + | return 4; //chosen by fair dice roll. | |
− | + | //guaranteed to be random. | |
} | } | ||
{{comic discussion}} | {{comic discussion}} | ||
[[Category:Programming]] | [[Category:Programming]] | ||
− | |||
− |