Without knowing the story format, it's hard to give specific advice. This will be fairly easy to implement in SugarCube, harder (but possible) in Harlowe.
I would implement it by:
- Tagging the passages you want to be randomized. Or the opposite. Assuming there are some passages that need to be fairly static, like starting and ending passages.
- Create an array of the appropriate passage names using the above information. Easy to do with Story.lookupWith() in SugarCube.
- Create a function that returns one of the passage names randomly (or by plucking it, if some / all passages should not be reused).
- Use that function in your links.
I would not recommend altering passage names. Treat them as read only at run-time.
SugarCube example code (goes in Story JavaScript:
(function () {
var passages = Story.lookupWith( function (passage) {
return passage.tags.includes("random");
}).map( function (passage) {
return passage.title;
});
function randomPassage () {
var psg = passages.pluck();
if (!tags(psg).includes("unique") {
passages.push(psg);
}
return psg;
}
setup.randomPassage = randomPassage;
}());
Usage:
[[link|setup.randomPassage()]]
In the Twine 2 app, you'll need to delete the passage named "setup.randomPassage()" that is auto-created before the link will work correctly.
The above code will return passages randomly if they have the "random" tag. Passages tagged "unique" will be removed from the array after being selected.
Note: this code was written from memory and may contain syntax errors, but the gist should be correct.
If you're using Harlowe: if you're comfortable with JavaScript, consider switching, especially if you're early on. This is possible in Harlowe but only through hacks and such.