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 7: | Line 7: | ||
}} | }} | ||
==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), which should return a random number. Most functions of this form are random number ''generators'', implying that they return on subsequent calls ''different'' numbers. But the programmer has instead created a function that just returns always the same ''random'' number; random, because it was chosen by rolling a die as the comment documented. This function is essentially worthless, as it could simply be replaced by a "4" wherever it is used. And in fact, most modern compilers would do this automatically. |
− | + | 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 have to 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. The <nowiki>RFC 1149.5</nowiki> simply does not exist. | |
− | |||
− | 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 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Transcript== | ==Transcript== | ||
− | |||
int getRandomNumber() | int getRandomNumber() | ||
{ | { | ||
− | + | return 4; //chosen by fair dice roll. | |
− | + | //guaranteed to be random. | |
} | } | ||
+ | |||
+ | ==Trivia== | ||
+ | The comic also has a philosophical bent, by showcasing the limits of knowledge for an external observer. Someone who is calling this function, but unable to see its source code, will never be able to tell with 100% confidence whether the function is flawed. Even if she runs the function 10 times, and it always returns 4, there is always the possibility that it could be a fluke. As she runs the function more and more times, she can develop more confidence in the theory that the function is faulty. But unless she breaks the barrier and examines the source code itself, she will never be able to declare the function to be faulty with 100% confidence. | ||
+ | |||
+ | Despite the extreme example given, this is actually a practical problem which likely exists in the real world. If the function was more sophisticated but still had a 5% bias towards one number under certain circumstances, this would be extremely hard to notice & prove. More likely, the API users would continue to believe that the RNG is working as intended, without realizing the flaw inherent in it; anyone who grumbles about seeing 4 very frequently may even be accused of not understanding the non-uniform nature of randomness. Given the extremely large number of APIs & libraries present, and that not all of them are fully examined & understood by 3rd party experts, such flaws are likely present in our world as well. These flaws may even have been purposely introduced by a malicious agent or entity seeking to exploit them. | ||
{{comic discussion}} | {{comic discussion}} | ||
[[Category:Programming]] | [[Category:Programming]] | ||
[[Category:Computers]] | [[Category:Computers]] | ||
− |