Difference between revisions of "1277: Ayn Random"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(added rational numbers explanation)
(Explanation)
Line 33: Line 33:
 
| style=white-space:nowrap | {{w|Rand Paul}} || US Politician, also influenced by Ayn Rand's writings.
 
| style=white-space:nowrap | {{w|Rand Paul}} || US Politician, also influenced by Ayn Rand's writings.
 
|-
 
|-
| style=white-space:nowrap | {{w|Ann Druyan}} || Author
+
| style=white-space:nowrap | {{w|Ann Druyan}} || Author, widow of {{w|Carl Sagan}}
 
|-
 
|-
 
| style=white-space:nowrap | {{w|Paul Rudd}} || Actor, screenwriter, comedian
 
| style=white-space:nowrap | {{w|Paul Rudd}} || Actor, screenwriter, comedian

Revision as of 21:51, 17 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 Python 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! ⋅ comment.png add a topic (use sparingly)! ⋅ 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)

Goedel doesn't say all philosophies are inconsistent. He proved that no mathematical system can be complete. Nitpicking (talk) 03:35, 21 June 2023 (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)

Goddammit Jorgbrown, I was going to say that! 108.162.237.89 22:14, 1 November 2016 (UTC)

Computers don't store any "thing", they store a representation. Therefore, a computer can reference any "thing", because representation "sets" can be swapped out. At any given moment, if the user is aware, "1" could mean a purple flying dog. At any other given moment, "1" could mean a swimming cactus. Therefore, the number of "things" that computers can store representations for is unlimited, even if the "set" of representations it can store at any given time is limited. In our specific example, the computer can store a representation of an irrational number by collapsing the number into a recursive or incremental method of reproducing the number. 108.162.216.114 20:07, 10 December 2014 (UTC)

"Although a computer could encode irrationals or generate them randomly if it uses another representation" - however even that is not enough. Whatever format you chooses you can only specify only definable numbers because other are... well cannot be defined. Whatever language you choose as long as you require the description to be finite you can cover only countable many of numbers. To cover all reals - including not only π or e but all of them - you need to have capability of storing infinitely large amount of memory. Similarly incremental method will give you only computable set. Either way you miss significantly large amount of numbers (ℶ₁ vs ℶ₀). This is ignoring that we cannot draw a number from natural numbers with equal probability (we would expect P(3|X) = 1/3 and P(¬3|X) = 2/3 but both sets are equal so we would expect P(3|X) = P(¬3|X)...). That's why we get random numbers for the finite set and normalize according to need. 172.68.142.227 07:55, 26 February 2017 (UTC)

So nobody noticed how "this ain't random" seems to be the first thing Cueball says? I think the pun "this Ayn/ain't random" is a big part of the joke. MigB (talk) 07:22, 8 June 2022 (UTC)

doesnt add up, sorry. ayn rand's first name is pronounced "ine" (/aɪn/), according to an ipa note on her page on wikipedia. the main part of the joke is that objectivism (ayn rand's main philosophy) claims to distribute resources fairly but does not, hence an "ayn random" number generator claims to distribute probability fairly but does not --172.70.114.43 13:31, 8 June 2022 (UTC)

The explanation of the regular expression doesn't explain what the parentheses do, if it's the \b that signifies "word". Nitpicking (talk) 03:35, 21 June 2023 (UTC)

\b isn't a 'word', it's a word boundary. The otherwise unmarked null-space between any word-character (usually defined as [A-Za-z0-9_], but more on that later) and either a non-word character or either end of the full string. For something like "This 1st-Class example", it should also match with any/all the \bs in "\bThis\b \b1st\b-\bClass\b \bexample\b".
The []s (if you're asking about them) groups characters together as an "it's one of these" element. A few particular characters that mean something special... the "-" in [a-z] means all characters from "a" to "z", or [4-6] would be 4, 5 or 6. An initial "^" means everything except the following provided group, and "\" meta-escapes anything that needs to be, so you could get "-" explicitly by "\-", or specify any of the whitespace class by "\s". But otherwise (and for the comic) it's just a list of characters. Case-sensitive unless the regexp (or a subset of it) is otherwise called with ignore-case instructions.
The ()s [probably what you meant] are a grouping-method, often used to internally or externally take note of any sub-match (or sub-sub-match, because you can nest them!) to make explicit use of them elsewhere. But here it acts to define the "thing" that the {}s refer to, to make it unnecessary to write it out again (and with a differently contrived flexibility of repetition). There are also various (?...) things to do with ()s, which are occasionally useful.
The {}s ([which you might also have been refering to, but I doubt it]) is described in the article but is commonly used to say "rematch the thing we just had a specific number of times". With "W{3,6}", it would need from three to six 'W's, "X{,6}" is anything up to six 'X's (not all implementations offer this, there are various other ways to define "no more than # times (and possibly zero)", if you need that), "Y{3,}" means at least three 'Y's and "Z{5}" is exactly that many. Combined with ()s, "(WXYZ){2}" means "WXYZWXYZ", combined with []s, "[WXYZ]{2}" means "WW", "WX", "WY", "WZ", "XW", "XX", ..., "ZY" or "ZZ". (There can also be the use of them in things like "\b{wb}", but that's different. And may not exist in all implementations.)
Using ()s and []s but (instead of {}s) using the a call-back to what was already matched, e.g. "([WXYZ])\1", requires a repeat to match the first match result (not just to be a new attempt to match any of the matchable elements). It would match "WW", "XX", "YY" and "ZZ" only. Using \1 instead of {2} in the comic's statement would not match plain "Duran Duran" (because the first match would be "Duran ", with the space, the second could only ever find "Duran") unless it was "...Duran Duran and something else...".
...Randall doesn't invoke much of that, actually. But if you're interested enough to want to know, far be it for me to deny you the information! ;)
TL;DR; - work your way through something like this, for Perl, this for Python or whatever treatment matches any other language/script-dialect you think you might be interested in using that could have inbuilt regexp notation/function to it. 141.101.99.157 10:22, 21 June 2023 (UTC)