The simplest way is to simply create an array of passage names in your StoryInit passage, like this:
<<set $passages = ["a", "b", "c"].shuffle()>>
The Array.shuffle() method will put the items in that array in a random order.
Then, in passage “1” you’d have the link to the next passage like this:
<<link "Next Passage Link Text" $passages[0]>><<set $nextLink = "2">><</link>>
That will send it to the first passage in the shuffled $passages
array, and will set $nextLink
to the name of the passage to go to after that. (See the <<link>>
macro for details.)
You’ll need to copy the above code into passages “2” and “3”, except add one more to each of the two numbers in that above line of code in each of those passages (e.g. ...$passages[1]..."3"...
for passage “2”, etc.).
Inside the “a”, “b”, and “c” passages, you’d have the following code to link to the next passage:
<<link "Next Passage Link Text" $nextLink>><</link>>
That will send it to the correct next passage based on the value of $nextLink, which we’re setting in passages “1” through “3”.
You can change the “Next Passage Link Text” to whatever you want in each of those lines of code.
Finally, in passage “4”, since you won’t need those variables anymore, you should get rid of them, like this:
<<unset $passages, $nextLink>>
and that should do the trick! (See the <<unset>>
macro for details.)
Have fun!