1277: Ayn Random

Explain xkcd: It's 'cause you're dumb.
(Difference between revisions)
Jump to: navigation, search
(Explanation)
(Explanation: Regular expression do not belong to a specific programming language.)
Line 12: Line 12:
 
[[White Hat]] is explaining to [[Cueball]] a program he wrote, the "Ayn Random Number Generator", which is a pun on {{w|Ayn Rand}}, the name of a writer who created a philosophical system known as {{w|Objectivism (Ayn Rand)|Objectivism}}. Objectivists believe that the primary aim of life is to maximise personal happiness. In their view, if some humans are born more capable of satisfying their desires than other people, they deserve to reap greater rewards from life than others. In the comic, White Hat uses a similar line of reason to justify some numbers appearing more often than others in a {{w|Random number generation|"random" number generator}}. Since the primary virtue in Objectivist ethics is rationality, and since rationality is highlighted extensively in Rand's writings, the implication may be that the random number generator favors rational numbers (numbers that can be written as a fraction, i.e. a quotient p/q where p and q have no common factor).
 
[[White Hat]] is explaining to [[Cueball]] a program he wrote, the "Ayn Random Number Generator", which is a pun on {{w|Ayn Rand}}, the name of a writer who created a philosophical system known as {{w|Objectivism (Ayn Rand)|Objectivism}}. Objectivists believe that the primary aim of life is to maximise personal happiness. In their view, if some humans are born more capable of satisfying their desires than other people, they deserve to reap greater rewards from life than others. In the comic, White Hat uses a similar line of reason to justify some numbers appearing more often than others in a {{w|Random number generation|"random" number generator}}. Since the primary virtue in Objectivist ethics is rationality, and since rationality is highlighted extensively in Rand's writings, the implication may be that the random number generator favors rational numbers (numbers that can be written as a fraction, i.e. a quotient p/q where p and q have no common factor).
  
The title text identifies a group of people whose names match the {{w|Perl (programming language)|Perl}} {{w|regular expression}} <code>/(\b[plurandy]+\b ?){2}/i</code>. A step-by-step explanation of the expression:
+
The title text identifies a group of people whose names match the {{w|regular expression}} <code>/(\b[plurandy]+\b ?){2}/i</code>. A step-by-step explanation of the expression:
 
*\b is a word boundary, matching anywhere there is a 'word character' next to a non-word character&mdash;punctuation, digit, spacing, etc.
 
*\b is a word boundary, matching anywhere there is a 'word character' next to a non-word character&mdash;punctuation, digit, spacing, etc.
 
*[plurandy] is a character class, and will match any single character from the set inside the square brackets; [adlnpruy] means exactly the same
 
*[plurandy] is a character class, and will match any single character from the set inside the square brackets; [adlnpruy] means exactly the same

Revision as of 09:11, 18 October 2013

Ayn Random
In a cavern deep below the Earth, Ayn Rand, Paul Ryan, Rand Paul, Ann Druyan, Paul Rudd, Alan Alda, and Duran Duran meet together in the Secret Council of /(\b[plurandy]+\b ?){2}/i.
Title text: In a cavern deep below the Earth, Ayn Rand, Paul Ryan, Rand Paul, Ann Druyan, Paul Rudd, Alan Alda, and Duran Duran meet together in the Secret Council of /(\b[plurandy]+\b ?){2}/i.

Explanation

Ambox notice.png This explanation may be incomplete or incorrect:
Please include the reason why this explanation is incomplete, like this: {{incomplete|
reason}}
If you can address this issue, please edit the page! Thanks.
White Hat is explaining to Cueball a program he wrote, the "Ayn Random Number Generator", which is a pun on Ayn Rand, the name of a writer who created a philosophical system known as Objectivism. Objectivists believe that the primary aim of life is to maximise personal happiness. In their view, if some humans are born more capable of satisfying their desires than other people, they deserve to reap greater rewards from life than others. In the comic, White Hat uses a similar line of reason to justify some numbers appearing more often than others in a "random" number generator. Since the primary virtue in Objectivist ethics is rationality, and since rationality is highlighted extensively in Rand's writings, the implication may be that the random number generator favors rational numbers (numbers that can be written as a fraction, i.e. a quotient p/q where p and q have no common factor).

The title text identifies a group of people whose names match the regular expression /(\b[plurandy]+\b ?){2}/i. A step-by-step explanation of the expression:

  • \b is a word boundary, matching anywhere there is a 'word character' next to a non-word character—punctuation, digit, spacing, etc.
  • [plurandy] is a character class, and will match any single character from the set inside the square brackets; [adlnpruy] means exactly the same
  • the plus sign means one or more of the previous thing, so [plurandy]+ matches one or many of the characters in that class, one after the other
  • " ?" - a space followed by a question mark: "?" means "0 or 1 of the previous thing", so a space is optional
  • the whole section in parentheses (\b[plurandy]+\b ?) translates to "a word containing one or more letters, all of which are in the set [plurandy], followed by an optional space"
  • the {2} on the end means to repeat the pattern, so it must match exactly twice
  • The slashes at each end mark out the pattern, and the "i" at the end is an expression qualifier means it is "case insensitive" (uppercase and lowercase match interchangeably)

Overall, it matches two words separated by a space, composed entirely of the letters in [plurandy], which is what all the names listed have in common.

Person Brief Description
Ayn Rand Author, best known for her novels The Fountainhead and Atlas Shrugged.
Paul Ryan US Politician known to have been influenced by the writings of Ayn Rand.
Rand Paul US Politician, also influenced by Ayn Rand's writings.
Ann Druyan Author, widow of Carl Sagan
Paul Rudd Actor, screenwriter, comedian
Alan Alda Actor, best known for the role of Hawkeye Pierce in the TV series M*A*S*H. Played Arnold Vinick, a fiscally-conservative Republican presidential candidate, in The West Wing.
Duran Duran New Wave/Rock band

Transcript

[Cueball sitting at a laptop, White Hat behind him.]
Cueball: This Ayn Random number generator you wrote claims to be fair, but the output is biased toward certain numbers.
White Hat: WELL, MAYBE THOSE NUMBERS ARE JUST INTRINSICALLY BETTER!
comment.png add a comment! ⋅ Icons-mini-action refresh blue.gif refresh comments!

Discussion

I think that should be /(\b[plurandy]+\b ?){2}/i.

173.66.108.213 05:12, 14 October 2013 (UTC)

I agree. I was confused for a while about what the b's were doing.

99.126.178.56 06:57, 14 October 2013 (UTC)

Maybe it's time to have an Ayn Rand category? --141.89.226.146 07:34, 14 October 2013 (UTC)

Can someone explain to the mathematically challenged *how* the list of names fits the regular expression? 141.2.75.23 09:14, 14 October 2013 (UTC)

Agreed, I would like to understand what the hell is going on with that. --Zagorath (talk) 09:20, 14 October 2013 (UTC)
How specific do you want it? Basically it matches two words consisting of the letters plurandy. The list of names is just a random selection of two part names that only consists of these letters. More specifically it matches: Two groups ({2}), each consisting of a word boundary (\b), followed by a non-empty sequence of the letters plurandy ([plurandy]+), followed by a word boundary (\b), finally followed by an optional space ( ?). Pmakholm (talk) 09:33, 14 October 2013 (UTC)
Also, the /'s on the end delimit the regex proper, and the `i` on the end denotes case insensitivity. --75.66.178.177 09:39, 14 October

2013 (UTC)

In the explanation of how the regex works after the explanation "the {2} on the end means to repeat the pattern, so it must match exactly twice" I think you need an explanation of how the optional space in the middle interacts with the word boundaries. I.e.
(\b[plurandy]+\b ?){2}
Expanding:
\b[plurandy]+\b ?\b[plurandy]+\b ?
Now the optional space at the end is redundant, and the space in the center is not optional, since if there is no space the word boundaries do not exist. If the space is present the word boundaries are redundent because letter space letter sequence always matches them.
\b[plurandy]+ [plurandy]+\b ?
And this now closely matches the text description "Overall, it matches two words separated by a space, composed entirely of the letters in [plurandy], which is what all the names listed have in common." --108.17.2.71 17:26, 16 October 2013 (UTC)
Some examples
  • "Ru Paul" would match, because it is two sequences, each containing only capital or lowercase versions of the listed letters.
  • "Randall Flagg" would not match, because the letters F and G are not in the bracketed list.
  • "Aura Anaya Adlar" would not match; even though the letters are all in the list, there are more than two sequences.
Hope this helps!
Swartzer (talk) 20:24, 15 October 2013 (UTC)

209.132.186.34 09:26, 14 October 2013 (UTC)

I do not think Randal would make such mistake, he would probably use \< \> anyway... unless, he wants us to think he did mistake, or that backslash was eliminated in html/javascript... thus poining ut to source code of the page... is there something interesting?

I skimmed over the source and didn't see anything unusual. The '\'s are absent from the source too. I think it's just that Randall (or a tool he's using) was so affraid of Bobby Tables that he stripped all backslashes from the alt text. Jahvascriptmaniac (talk) (please sign your comments with ~~~~)
The title text at xkcd.com now has the missing backslashes. Do you normally update the comic here to reflect updates?--108.17.2.71 16:14, 14 October 2013 (UTC)
Already updated. You were saying?
Hmm, backslashes are still missing for me when viewing the original at xkcd.com (viewing in Chrome) Brion (talk) 02:33, 20 December 2013 (UTC)

Can someone explain to me where "In their view, if some humans are born more capable of satisfying their desires than other people, they deserve to reap greater rewards from life than others" comes from? I'm somewhat familiar with objectivist philosophy and I've never heard this put forward as an actual principle. 50.90.39.56 14:14, 14 October 2013 (UTC)

Objectivism is the target for much scorn and ridicule in the intellectual world, for its being an inconsistent philosophy that has the sole objective of justifying selfishness and elevating it towards moral righteousness. It's used as the basis for libertarian thought and other radical capitalist economical theories and political stances which promote shameless exploitation (and this attracts further hatred). Randall is no exception to this trend of detractors, and I'd say rightfully so. Ayn Rand's writings are particularly awful, both aesthetically and content-wise, yet in the US a relatively large group of philosophers still adhere to her maxims and the debate continues. 37.221.160.203 (talk) (please sign your comments with ~~~~)
In fact, this is an imprecise and, therefore, incorrect statement of Objectivist philosophy. A correct and more complete statement can be found under the entry for "Selfishness" in the Ayn Rand Lexicon: "The Objectivist ethics holds that human good does not require human sacrifices and cannot be achieved by the sacrifice of anyone to anyone. It holds that the rational interests of men do not clash—that there is no conflict of interests among men who do not desire the unearned, who do not make sacrifices nor accept them, who deal with one another as traders, giving value for value."108.162.237.8 23:38, 31 December 2013 (UTC)

Most people would write the regexp as /(\b[adlnpruy]+\b ?){2}/i. Using "plurandy" makes it look like a word, which is more confusing than using the letters' natural order. --Ralfoide (talk) 15:58, 14 October 2013 (UTC)

Would it be better to identify Alan Alda not for his role as Hawkeye Pierce in MASH, but for his role in The West Wing as Arnold Vinick, a fiscally-conservative Republican presidential candidate? 193.67.17.36 16:03, 14 October 2013 (UTC)

Depends, are we trying to remind him to general audience (I think MASH is more known) or find out why he was included in list? -- Hkmaly (talk) 08:50, 16 October 2013 (UTC)

There is probably an additional joke or three in that the regex is the minimum needed to capture the first three names together (hinted at by "plurandy" eg plural rand) , but also captures the others. on top of which all of the listed people are considered "intrinsically better" (by virtue of fame if nothing else)74.213.201.51 03:14, 15 October 2013 (UTC)

Alan Ladd may have been a founding member of the Secret Council of /(\b[plurandy]+\b ?){2}/i. 71.190.237.117 07:15, 15 October 2013 (UTC)

It's probably obvious to most programmers, but is it worth pointing out that part of the pun is that the random number generator function is called rand() in most C-family languages? 130.60.156.183 14:07, 15 October 2013 (UTC)

Another member of this secret society is Randall P 79.182.178.53 16:45, 15 October 2013 (UTC)

From above: "Objectivism is the target for much scorn and ridicule in the intellectual world, for its being an inconsistent philosophy that has the sole objective of justifying selfishness and elevating it towards moral righteousness. It's used as the basis for libertarian thought and other radical capitalist economical theories and political stances which promote shameless exploitation (and this attracts further hatred). Randall is no exception to this trend of detractors, and I'd say rightfully so. Ayn Rand's writings are particularly awful, both aesthetically and content-wise, yet in the US a relatively large group of philosophers still adhere to her maxims and the debate continues." OK, but a few comments: All philosophies are inconsistent when looked at closely enough, refer Godel and others. Others do not see the inconsistency in Objectivism quite so plainly as in the quoted comment. Ayn Rand and Objectivism are not "the" basis of libertarian thought, there are far more highly thought of libertarian thinkers, a list of whom should come readily to mind to any of those occupying "the intellectual world" (sic), whether or not they have sympathy with libertarian ideas. It is also unfair to characterise Objectivism as having as its "sole" objective that as stated. Further, as a general principle, one ought not to take someone poking fun at a concept as *proof* that they are quite as opposed to it as you are. Now, whereas I would not categorise myself quite as a fellow traveller, a much fairer view of Objectivism is found at WP: http://en.wikipedia.org/wiki/Objectivism_(Ayn_Rand) 81.135.136.159 11:22, 16 October 2013 (UTC)

Other philosophies are no more consistent, agreed. But other philosophies do not claim perfect "objective" consistency as their fundamental principle. Attacking Objectivism/Objectivists for lack of internal consistency--or for not recognizing that at some, very fundamental, level it is all stacked on top of some assumptions (just like every other philosophy, and even the scientific method)--is the equivalent of attacking Christianity/Christians for lacking compassion and forgiveness. 129.176.151.14 14:04, 16 October 2013 (UTC)
Poking fun can indeed fall into the categories of self-irony or goodwill, but in this case Randall quite explicitly accuses the recipient of bias, making his disapproval pretty unequivocal. 199.48.147.40 16:51, 16 October 2013 (UTC)

I have added a line about the rational numbers joke; it's definitely there, though I'm not sure if Randall intended it (probably did?). 76.124.119.161 (talk) (please sign your comments with ~~~~)

Don't think it makes much sense, because a random number generator algorithm of any kind couldn't possibly generate irrational numbers in finite time. 77.244.254.228 16:34, 17 October 2013 (UTC)
It does make sense, mathematically speaking a random number chosen in any open interval is irrational with probability 1, and yet any open interval contains rational numbers that could, in principal, be chosen due to density of the rationals. The joke is brilliant, if intended. 76.124.119.161 04:00, 18 October 2013 (UTC)
Yes but, at that point, all random number generators are biased and not just the Ayn Random number generator. Also, the bias towards rational numbers doesn't seem to be there when your pool of numbers is just the rationals. The whole idea behind the joke seems to be more like Ayn Rand's assumptions of objectivity ending up favoring certain social groups. I dunno, it just seems forced to me. 220.117.150.36 19:00, 18 October 2013 (UTC)
Considering real numbers are well-understood mathematically this seems like a shortcoming of implementation, which isn't that interesting... the concept is there. 76.124.119.161 22:06, 18 October 2013 (UTC)
The whole idea behind random number generation bias is the bugs they can create within software implementation (for example, weakening cryptography). An hypothetically generated irrational number would have to be truncated at some decimal place (thus making it rational) for it to be usable. Here it's a programming joke, not a math one. 95.229.229.31 22:37, 18 October 2013 (UTC)
...unless interpreted as a math joke. I agree that the joke admits programming interpretation, but I'd never try to exclude other interpretations as well. The math interpretation is valid since one can choose not to get muddled in implementation and to instead envision a hypothetical random number generator not bound by truncation. Randall's comics certainly admit this kind of whimsy. 76.124.119.161 23:55, 18 October 2013 (UTC)
Well, it says "This Ayn Random number generator you wrote" so I'd take it at face value, but that's just me. 95.229.229.31 00:33, 19 October 2013 (UTC)

And somehow, no one's mentioned the classic cartoon 221:Random Number, which presents a random number generator which is heavily biased towards one number. JamesCurran (talk) 21:58, 17 October 2013 (UTC)

Is the joke here not along the lines that Ayn Rand's politics, and that of Libertarianism, claim that they are fair and that they treat everyone equally - in that, supposedly, anyone can get what they want and be successful if they work hard - but the reality is that some people will fare better than others due to having certain advantages such as having been born into wealth, knowing the right people, one might even suggest that being white, middle class and male are advantageous. In a random number generator you would expect any number to be as likely to come up as any other. Similarly, Rand supporters would argue that under Objectivism, any person is by default as able to be successful as any other. The fact that some people succeed and others fail is explained as some people being inherently more able to succeed, rather than any bias in the system itself - hence she divides people into 'looters' and 'moochers'; there's also that scene I always remember in Dirty Dancing where the guy chucks a copy of The Fountainhead in Baby's direction and says 'some people count, some people don't'. Randall is mocking the idea of a system that is supposedly inherently fair and yet biases certain classes of people, with the idea of a 'random' number generator that is biased towards certain numbers not because of a problem with the system but because some numbers are supposedly 'inherently better'.213.86.4.78 15:09, 21 October 2013 (UTC)

Regarding rational numbers, p and q are allowed to have a common factor. 3/3 is still rational, just not reduced. Every rational number has an irreducible representation, but it doesn't have to be reduced to be part of the set of rationals. Also, since the definition is otherwise very specific, it could mention that q cannot be 0, which I don't think is mentioned. While that's a neat observation, I agree with the guy above that pointed out that no implementation of a random number generator produces irrational numbers. It isn't simply that the random number generator has to truncate the number, but you cannot fit infinite digits which neither terminate or repeat in a physical computer's finite memory. The random number generator would have to return symbolic results like "sqrt 2" or "e" instead of numerical values, but not returning actual numbers makes the idea of it being a random 'number' generator debatable. 173.245.52.197 (talk) (please sign your comments with ~~~~)

All numbers are random, but some numbers are more random than others. Jorgbrown (talk) 23:33, 2 November 2014 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

It seems you are using noscript, which is stopping our project wonderful ads from working. Explain xkcd uses ads to pay for bandwidth, and we manually approve all our advertisers, and our ads are restricted to unobtrusive images and slow animated GIFs. If you found this site helpful, please consider whitelisting us.

Want to advertise with us, or donate to us with Paypal or Bitcoin?