“Once, in a contest with a rival, he painted a blue curve on a huge sheet of paper. Then he dipped the feet of a chicken in red paint and persuaded the bird to walk all over the paper. The resulting image, he said, represented the Tatsuta river with red maple leaves floating in it. The judge gave him the prize.” — The Japanese artist Katsushika Hokusai (c. 1760-1849) described in Thomas W. Hodgkinson’s and Hubert van den Bergh’s *How to Sound Cultured* (2015).

# Category Archives: Randomness

# Dice in the Witch House

“Who could associate mathematics with horror?”

John Buchan answered that question in “Space” (1911), long before H.P. Lovecraft wrote masterpieces like “The Call of Cthulhu” (1926) and “Dreams in the Witchhouse” (1933). But Lovecraft’s use of mathematics is central to his genius. So is his recognition of both the importance and the strangeness of mathematics. Weird fiction and maths go together very well.

But weird fiction is about the intrusion or eruption of the Other into the everyday. Maths can teach you that the everyday is already Other. In short, reality is weird — the World is a Witch House. Let’s start with a situation that isn’t obviously weird. Suppose you had three six-sided dice, A, B and C, each with different set of numbers, like this:

Die A = (1, 2, 3, 6, 6, 6)

Die B = (1, 2, 3, 4, 6, 6)

Die C = (1, 2, 3, 4, 5, 6)

If the dice are fair, i.e. each face has an equal chance of appearing, then it’s clear that, on average, die A will beat both die B and die C, while die B will beat die C. The reasoning is simple: if die A beats die B and die B beats die C, then surely die A will beat die C. It’s a transitive relationship: If Jack is taller than Jim and Jim is taller than John, then Jack is taller than John.

Now try another set of dice with different arrangements of digits:

Die A = (1, 2, 2, 5, 6, 6)

Die B = (1, 1, 4, 5, 5, 5)

Die C = (3, 3, 3, 3, 4, 6)

If you roll the dice, on average die A beats die B and die B beats die C. Clearly, then, die A will also beat die C. Or will it? In fact, it doesn’t: the dice are what is called non-transitive. Die A beats die B and die B beats die C, but die C beats die A.

But how does that work? To see a simpler example of non-transitivity, try a simpler set of random-number generators. Suppose you have a triangle with a short rod passing through its centre at right angles to the plane of the triangle. Now imagine numbering the edges of the triangles (1, 2, 3) and throwing it repeatedly so that it spins in the air before landing on a flat surface. It should be obvious that it will come to rest with one edge facing downward and that each edge has a 1/3 chance of landing like that.

In other words, you could use such a spiked triangle as a random-number generator — you could call it a “trie”, plural “trice”. Examine the set of three trice below. You’ll find that they have the same paradoxical property as the second set of six-sided dice above. Trie A beats trie B, trie B beats trie C, but trie C beats trie A:

Trie A = (1, 5, 8)

Trie B = (3, 4, 7)

Trie C = (2, 3, 9)

When you throw two of the trice, there are nine possible outcomes, because each of three edges on one trie can be matched with three possible edges on the other. The results look like this:

Trie A beats Trie B 5/9ths of the time.

Trie B beats Trie C 5/9ths of the time.

Trie C beats Trie A 5/9ths of the time.

To see how this works, here are the results throw-by-throw:

Trie A = (1, 5, 8)

Trie B = (3, 4, 7)

When Trie A rolls 1…

…and Trie B rolls 3, Trie B wins (Trie A has won 0 out of 1)

…and Trie B rolls 4, Trie B wins (0 out of 2)

…and Trie B rolls 7, Trie B wins (0 out of 3)

When Trie A rolls 5…

…and Trie B rolls 3, Trie A wins (1/4)

…and Trie B rolls 4, Trie A wins (2/5)

…and Trie B rolls 7, Trie B wins (2/6)

When Trie A rolls 8…

…and Trie B rolls 3, Trie A wins (3/7)

…and Trie B rolls 4, Trie A wins (4/8)

…and Trie B rolls 7, Trie A wins (5/9)

Trie B = (3, 4, 7)

Trie C = (2, 3, 9)

When Trie B rolls 3…

…and Trie C rolls 2, Trie B wins (Trie B has won 1 out of 1)

…and Trie C rolls 3, it’s a draw (1 out of 2)

…and Trie C rolls 9, Trie C wins (1 out of 3)

When Trie B rolls 4…

…and Trie C rolls 2, Trie B wins (2/4)

…and Trie C rolls 3, Trie B wins (3/5)

…and Trie C rolls 9, Trie C wins (3/6)

When Trie B rolls 7…

…and Trie C rolls 2, Trie B wins (4/7)

…and Trie C rolls 3, Trie B wins (5/8)

…and Trie C rolls 9, Trie C wins (5/9)

Trie C = (2, 3, 9)

Trie A = (1, 5, 8)

When Trie C rolls 2…

…and Trie A rolls 1, Trie C wins (Trie C has won 1 out of 1)

…and Trie A rolls 5, Trie A wins (1 out of 2)

…and Trie A rolls 8, Trie A wins (1 out of 3)

When Trie C rolls 3…

…and Trie A rolls 1, Trie C wins (2/4)

…and Trie A rolls 5, Trie A wins (2/5)

…and Trie A rolls 8, Trie A wins (2/6)

When Trie C rolls 9…

…and Trie A rolls 1, Trie C wins (3/7)

…and Trie A rolls 5, Trie C wins (4/8)

…and Trie A rolls 8, Trie C wins (5/9)

The same reasoning can be applied to the six-sided non-transitive dice, but there are 36 possible outcomes when two of the dice are thrown against each other, so I won’t list them.

Die A = (1, 2, 2, 5, 6, 6)

Die B = (1, 1, 4, 5, 5, 5)

Die C = (3, 3, 3, 3, 4, 6)

Elsewhere other-posted:

• At the Mountains of Mathness

• Simpson’s Paradox — a simple situation with a very weird outcome

# He Say, He Sigh, He Sow #27

“When you run and jump on rocks, your entire brain and body are at work; you stretch your back better than with yoga; every muscle in your body is involved; no two movements will be identical (unlike running in gyms); you become yourself.” — Nassim Taleb, *Opacity: A Philosophical Notebook*.

# The Brain in Pain

You can stop reading now, if you want. Or can you? Are your decisions really your own, or are you and all other human beings merely spectators in the mind-arena, observing but neither influencing nor initiating what goes on there? Are all your apparent choices in your brain, but out of your hands, made by mechanisms beyond, or below, your conscious control?

In short, do you have free will? This is a big topic – one of the biggest. For me, the three most interesting things in the world are the Problem of Consciousness, the Problem of Existence and the Question of Free Will. I call consciousness and existence problems because I think they’re real. They’re actually there to be investigated and explained. I call free will a question because I don’t think it’s real. I don’t believe that human beings can choose freely or that any possible being, natural or supernatural, can do so. And I don’t believe we truly want free will: it’s an excuse for other things and something we gladly reject in certain circumstances.

Continue reading The Brain in Pain…

# The Whisper from the Sea

─But what is that whisper?

─Ah. Then ye hear it?

─Aye. ’Tis thin and eerie, mingling with the waves, and seemeth to come from great distance. I know not the language thereof, but I hear great rage therein.

─As well ye might. We stand near the spot at which the wizard Zigan-Uvalen bested a demon sent against him by an enemy. ’Tis the demon’s whisper ye hear.

─Tell me the tale.

─It is after this wise…

Zigan-Uvalen woke to a stench of brimstone, a crackle of flame, and found himself staring up at a fearsome ebon face, lapped in blood-red fire, horned with curling jet, fanged in razor-sharp obsidian.

“Wake, Wizard!” the apparition boomed. “And make thy peace with thy gods, for I am come to devour thee!”

Zigan-Uvalen sat up and pinched himself thrice.

“Without introduction?” he asked, having verified that he was truly awake.

“Introduction?”

“Well, ’tis customary, in the better magickal circles.”

“Aye? Then know this: I am the Demon Ormaguz, summoned from the hottest corner of the deepest pit of Hell by your most puissant and malicious enemy, the wizard Muran-Egah. I have been dispatched by him over many leagues of plain and ocean to wreak his long-meditated, slow-readied, at-last-matured vengeance on thee.”

“Very well. And what are your qualifications?”

“Qualifications?”

“Aye. Are ye *worthy* of him who sent you, O Demon Ormaguz?”

“Aye, that I am! And will now dev–”

“Nay, nay!” The wizard raised a supplicatory hand. “Take not offence, O Ormaguz. I ask merely out of form. ’Tis customary, in the better magickal circles.”

“Truly?”

“Truly.”

“Then know this… Well, of formal qualifications, diplomas, and the like, I have none, ’tis true. But I am a demon, thou puny mortal. I have supernatural powers of body and mind, far beyond thy ken.”

“I doubt them not. At least, I doubt not your powers of body, in that ye have travelled so very far and very fast this very night. Or so ye say. But powers of mind? Of what do they consist?”

“Of aught thou carest to name, O Wizard.”

“Then ye have, for instance, much mathematical skill?”

“Far beyond thy ken.”

“How far?”

“Infinitely far, wizard!”

“Infinitely? Then could ye, for instance, choose a number at hazard from the whole and endless series of the integers?”

“Aye, that I could!”

“Entirely at hazard, as though ye rolled a die of infinite sides?”

“Aye! In less than the blink of an eye!”

“Well, so ye say.”

“So I say? Aye, so I say, and say sooth!”

“Take not offence, O Demon, but appearances are against you.”

“Against me?”

“Ye are a demon, after all, unbound by man’s pusillanimous morality.”

“I speak sooth, I tell thee! I could, in an instant, choose a number, entirely at hazard, from the whole and endless series of the integers.”

“And speak it to me?”

“Ha! So that is thy game, wizard! Thou seekest to occupy me with some prodigious number whilst thou makest thy escape.”

“Nay, nay, ye misjudge me, O Demon. Let me suggest this. If ye can, as ye say, choose such a number, then do so and recite its digits to me after the following wise: in the first second, name a single digit – nay, nay, O Demon, hear me out, I pray! Aye, in the first second, name a *single* digit thereof; in the second second, name *four* digits, which is to say, two raised to the second power; in the third second, name a number of digits I, as a mere mortal, cannot describe to you, for ’tis equal to three raised to the third power of three.”

“That would be 7,625,597,484,987 digits named in the third second, O Wizard.”

“Ah, most impressive! And your tongue would not falter to enunciate them?”

“Nay, not at all! Did I not tell thee my powers are supernatural?”

“That ye did, O Demon. And in the fourth second, of course, ye would name a number of digits equal to four raised to four to the fourth power of four. And so proceed till the number is exhausted. Does this seem well to you?”

“Aye, very well. Thou wilt have the satisfaction of knowing that ’tis an *honest* demon who devoureth thee.”

“That I will. Then, O Ormaguz, prove your honesty. Choose your number and recite it to me, after the wise I described to you. Then devour me at your leisure.”

─Then the Demon chose a number at hazard from the whole and endless series of the integers and began to recite it after the wise Zigan-Uvalen had described. That was eighteen centuries ago. The demon reciteth the number yet. That is the whisper ye hear from the sea, which rose long ago above the tomb of Zigan-Uvalen.

# The World as Worm

In “Hymn to Herm”, I wrote about a religion based on √2, or the square root of two, the number that, multiplied by itself, equals 2. In the religion, neophytes learn the mystery and majesty of this momentous number when they try to calculate its exact value. The calculation involves adding and subtracting fractions based on powers of two. The first step is this: 1 x 1 = 1. So that’s too small. Add 1/2^1 = ½ and re-multiply: 1½ x 1½ = 2¼. Too big. So subtract 1/2^2 = ¼, and re-multiply. 1¼ x 1¼ = 1+9/16. Too small. Add 1/8 and re-multiply. 1+3/8 x 1+3/8 = 1+57/64. Too small again. Add 1/16 and re-multiply. And so on.

In effect, what the neophytes are doing is calculate the digits of √2 in binary, or base two. When the multiplication is too small, put a 1; when it’s too big, put a 0. Like this:

1 x 1 = 1 < 2, so √2 ≈ 1·…

1½ x 1½ = 2¼ > 2, so √2 ≈ 1·0…

1¼ x 1¼ = 1+9/16 < 2, so √2 ≈ 1·01…

(1+3/8) x (1+3/8) = 1+57/64 < 2, so √2 ≈ 1·011…

(1+7/16) x (1+7/16) = 2+17/256 > 2, so √2 ≈ 1·0110…

(1+13/32) x (1+13/32) = 1+1001/1024 < 2, so √2 ≈ 1.01101…

(1+27/64) x (1+27/64) = 2+89/4096 > 2, so √2 ≈ 1.011010…

(1+53/128) x (1+53/128) = 1+16377/16384 < 2, so √2 ≈ 1·0110101…

(1+107/256) x (1+107/256) = 2+697/65536 > 2, so √2 ≈ 1·01101010…

(1+213/512) x (1+213/512) = 2+1337/262144 > 2, so √2 ≈ 1·011010100…

(1+425/1024) x (1+425/1024) = 2+2449/1048576 > 2, so √2 ≈ 1·0110101000…

(1+849/2048) x (1+849/2048) = 2+4001/4194304 > 2, so √2 ≈ 1·01101010000…

(1+1697/4096) x (1+1697/4096) = 2+4417/16777216 > 2, so √2 ≈ 1·011010100000…

(1+3393/8192) x (1+3393/8192) = 1+67103361/67108864 < 2, so √2 ≈ 1·0110101000001…

Mathematically naïve neophytes, seeing the process miss 2 by smaller and smaller amounts on either side, might imagine that eventually the exact root will appear and the calculations end. But they would be wrong. They could work a year or a million years: they would never calculate the exact square root of two. There is no ratio of whole numbers, *a*/*b*, such that *a*^2/*b*^2 = 2. In other words, √2 is an irrational number, or number that can’t be represented as a ratio of integers (please see appendix for the proof).

This discovery, made by Greek mathematicians more than two millennia ago, is both mind-boggling and world-shattering. In fact, it’s mind-boggling in part because it’s world-shattering. √2 shatters the world because the world is too small to contain it: in the words of the Cult of Infinite Hermaphrodites, “Were the sky all parchment, the seas all ink, and gulls all plucked for quills”, the square root of two could not be recorded in full. This is far more certain than tomorrow’s sunrise, because predicting tomorrow’s sunrise depends on fallible scientific reasoning from incomplete knowledge. Proving the irrationality of √2 depends on infallible mathematical reasoning.

At least, it’s as close to infallible as human beings can get. But that’s another part of what is mind-boggling about √2. A finite, feeble human being, with a speck of soon-decaying brain, can prove the existence of things larger than the universe. A few binary digits of √2 are shown above. Here are a few more:

1· 0110101000001001111001100110011111110011101111001100100100001000 1011001011111011000100110110011011101010100101010111110100111110 0011101011011110110000010111010100010010011101110101000010011001 1101101000101111010110010000101100000110011001110011001000101010 1001010111111001000001100000100001110101011100010100010110000111 0101000101100011111111001101111110111001000001111011011001110010 0001111011101001010100001011110010000111001110001111011010010100 1111000000001001000011100110110001111011111101000100111011010001 1010010001000000010111010000111010000101010111100011111010011100 1010011000001011001110001100000000100011011110000110011011110111 1001010101100011011110010010001000101101000100001000101100010100 1000110000010101011110001110010001011110111110001001110001100111 1000110110101011010100010100011100010111011011111101001110111001 1001011001010100110001101000011001100011111001111001000010011011 1110101001011110001001000001111100000110110111001011000001011101 1101010101001001010000010001001100100000100000011001010010010101 0000001001110010100101010110110110110001111110100001110111111011 1110100110100111010000000101100111010111100100100111110000011000 1000010011001001101101010111100110101010010100010110110010100011 0111000110011110011010000011011011011111000001000110110110001110 0000001000001001101110000000001111111100011001000110101001011110 0110011001010100101111010011111011110111101101000011110101111111 1110110101000011011111000111111110010100010001000010011000001111 1011110101000000110001001000001111101111010101010000001110000101 1000001111111001011110111011110101000101111011111011100001100110 0011000100000111000101000101110101011111111010111110011101100101 1010010010011110100101001110110001111111010110010111000100000101 1111101111111100001011100001111110100111011000111110111100000001 1111001101011001100111001000001011110010111111100101000000001011 1000010010001100111100001011110100100101001010101110000001000110 1011111110011111000111101111011110010100011111010100011001110110 1001101011111000110000010100101111001100011001111100011111000010 1001000010111110011101101001001010011011000001010111100011000001 0000101101011000010011111011010010000111110010010010010011110101 1011011100011111100000101101110011010010100100000011011000001001 1101111011101000100100010010100110000011110101001110101010101101 0000111011101010001100100001111101110100100010011111010001101010 0111111010010000001100001011111000100000111110110111011010010100 1110111110110101100011001001100110000100110011011101011100001010 0001110110101001000001000101110000111101000100110011101000000110 1000010000100011110101101110001110000011000000111101100100000001 1011101010011101101000110100011101100110100001000111100101101100 0101110011010101100101110010110111000000111111110011010101000000 1100001101000001001010010100001011010110010000000110000100000001 1110111101101111110001101101111010010001000101001010001010110100 1111001001001000110001101000100111000110000000001011101101000000 1010100010110101011010110000010000011111110101011101111001101110 0000110111010000110001100110110101001000001100011111111001111111 1111111101010111010101111110010001110001000010011000000011001101 1011110101011100001001101000010010000101110110100101111010010001 1011001111100010111100100000010110110111001001110010010110111001 0111000111010110000010100001111110001000100011110000100010100000 1010011011100001000000001100110011101101110000101100111001011011 1101100110001010111011100111000111100100001011100010011010001101 0011011110100110000001110010111100100010000000100011010001100001 0011111111111100001000100100010100110100001110011110101010010111 1010100110011001101101101100100111100011110011100111000111111001 0100110101100000100100101010110011100001001000001010101110001110 0101010100001110000011010101010100010001011010001000011000110001 0111011110001100111101100000001101010000110100000010111111101000 0101111100101001111011001000101111100101110001110010101110000000 0111101011110101011101110001101110000010010110110011000010100000 1110011110000011011101101010100100011100000010001100011010100111 1111000011111000111100110010001110110011011000101000000111010010 0010010101101000100111000000101101011010100000100000010001111101 1011100110001001111101100011101010001010011001001110100001010001 1001101111000000110100001100000111100010001000101000000001001000 0100110110010100111101001111100110111011001111010100101100110001 1101010010001001110101110101001000110001101101011100011000110011 1100010010000000110010010110101111100101010010011011111101011101 1001011001100111100010110100110100101100010011011101101010000110 0111101111011000111001001000000000101001111111101010100011001000 0001011100110101011001111100001010111010001111010011110011101001 1101111111100000101111010001101101001101110101110111000100010111 1000000001010111101101101001010110110111111010101111000110110000 0101110000100010110010001101010111111110111010111101000001110111 1111111011001001011011011011100011110111011110001111110000011100 0010101110111011110011100001101101001001111010111111010110101111 0100010001100000100010000010100101011000101011011101000000011100 1010011111110001101101101011110000001011011111101100000110111100 0110111000001010011011101101101111000110011111111000010110110010 0111010011100000100001100001101100111010000100110111010101110001 1011000101100101010010011000011100111101001000010001110001101010 1010111001101001110110000000000111100101011110010100010001011011 1100011000001010001111100000101001001111110110001001011010001110 1011011110010100101111011100011100000010110101101001010001011101 1010100101001011000001001010010001000000110010101011110010010100 0011100001111100001111010010011011111101000011110011101111101000 1010111101100011000001011010010100111010000101110111001010001000 1010110010100001001111111011010000000110110010011000001010010001 0101110110000011101110100000110100110101010110001101100000011101 1101000100010101100111101001011001000011111010101010001001111110 1011011101110101011110100010000001010010100101110101101101101111 0100101010001000100111100011110100001001001010111011000111000110 1000010101001000000011011100001011101001100110010100011110110011 0111001011011110110110100000010111100010000110010010111110010101 1011000110111001001001100101000100101011010000000100110000110011 0001100000011101011...

The distribution of 1’s and 0’s seems effectively random, as though the God of Mathematics were endlessly tossing a coin, putting 1 for heads, 0 for tails. Yet √2 is the opposite of a random number. Change a single digit anywhere and it ceases to be √2. Every 1 and every 0 is rigidly determined by “unalterable law”. So are the position and magnitude of the digits of √2 in every other base. Here, for example, is √2 in base 4:

1· 112220021321212133303233030210020230233230103121232222111133 103320322313230011311010213131100212131220233112100230012121 303020222211133210012002013111...

Another word for base-4 is DNA: genes are in fact written in a base-4 code based on the chemicals guanine, adenine, thymine and cytosine, or G, A, T, C for short. If the digits of √2 are truly random, in the statistical sense, then all genomes, actual and potential, occur somewhere along its length: yours, mine, the Emperor Heliogabalus’s, Bilbo Baggins’, the sabre-toothed tiger’s, the dodo’s, and so on. But almost all the “DNA” of √2 in base-4 will be meaningless: although √2 is the opposite of random, it is effectively a typing chimpanzee. Or a typing worm – a type-worm. √2 is like an endless worm that types out its own segments on a typewriter with two keys (for binary numbers) or four keys (for quaternary numbers) or ten keys (for decimal numbers) and so on.

But √2 doesn’t just encode the genomes of individual people, animals and plants: it encodes everything they do throughout their lives. In fact, it encodes the entire universe. And perhaps the universe is √2 or some number like it. Perhaps, in some sense, everything exists within the digits of an irrational number, or a sufficiently large rational number. If so, then √2 has become aware of itself through human beings: the World as Worm has bitten its own tail.

**Appendix: Proof of the irrationality of √2**

1. Suppose that there is some ratio, *a*/*b*, such that

2. *a* and *b* have no factors in common and

3. *a*^2/*b*^2 = 2.

4. It follows that *a*^2 = 2*b*^2.

5. Therefore *a* is even and there is some number, *c*, such that 2*c *=* a*.

6. Substituting *c* in #4, we derive (2*c*)^2 = 4*c*^2 = 2*b*^2.

7. Therefore 2*c*^2 = *b*^2 and *b* is also even.

8. But #7 contradicts #2 and the supposition that *a* and *b* have no factors in common.

9. Therefore, by *reductio ad absurdum*, there is no ratio, *a*/*b*, such that *a*^2/*b*^2 = 2. Q.E.D.

# This Means RaWaR

The Overlord of the Über-Feral says: Welcome to my bijou bloguette. You can scroll down to sample more or simply:

• Read a Writerization at Random: RaWaR

• O.o.t.Ü.-F.: More Maverick than a Monkey-Munching Mingrelian Myrmecologist Marinated in Mescaline…

• ¿And What Doth It Mean To Be Flesh?

*Der Muntsch ist Etwas, das überwunden werden soll.

# V for Vertex

To create a simple fractal, take an equilateral triangle and divide it into four more equilateral triangles. Remove the middle triangle. Repeat the process with each new triangle and go on repeating it. You’ll end up with a shape like this, which is known as the Sierpiński triangle, after the Polish mathematician Wacław Sierpiński (1882-1969):

But you can also create the Sierpiński triangle one pixel at a time. Choose any point inside an equilateral triangle. Pick a corner of the triangle at random and move half-way towards it. Mark this spot. Then pick a corner at random again and move half-way towards the corner. And repeat. The result looks like this:

A simple program to create the fractal looks like this:

initial()

repeat

fractal()

altervariables()

until falsefunction initial()

v = 3 [v for vertex]

r = 500

lm = 0.5

endfuncfunction fractal()

th = 2 * pi / v

[the following loop creates the corners of the triangle]

for l = 1 to v

x[l]=xcenter + sin(l*th) * r

y[l]=ycenter + cos(l*th) * r

next l

fx = xcenter

fy = ycenter

repeat

rv = random(v)

fx = fx + (x[rv]-fx) * lm

fy = fy + (y[rv]-fy) * lm

plot(fx,fy)

until keypressed

endfuncfunction altervariables()

[change v, lm, r etc]

endfunc

In this case, more is less. When v = 4 and the shape is a square, there is no fractal and plot(fx,fy) covers the entire square.

When v = 5 and the shape is a pentagon, this fractal appears:

But v = 4 produces a fractal if a simple change is made in the program. This time, a corner cannot be chosen twice in a row:

function initial()

v = 4

r = 500

lm = 0.5

ci = 1 [i.e, number of iterations since corner previously chosen]

endfuncfunction fractal()

th = 2 * pi / v

for l = 1 to v

x[l]=xcenter + sin(l*th) * r

y[l]=ycenter + cos(l*th) * r

chosen[l]=0

next l

fx = xcenter

fy = ycenter

repeat

repeat

rv = random(v)

until chosen[rv]=0

for l = 1 to v

if chosen[l]>0 then chosen[l] = chosen[l]-1

next l

chosen[rv] = ci

fx = fx + (x[rv]-fx) * lm

fy = fy + (y[rv]-fy) * lm

plot(fx,fy)

until keypressed

endfunc

One can also disallow a corner if the corner next to it has been chosen previously, adjust the size of the movement towards the chosen corner, add a central point to the polygon, and so on. Here are more fractals created with such variations: