I6: Generating a random-ish number

So, as part of one of the puzzles in my game, there is a to-do list for the player, comprised of assorted chores and such. On every playthrough, one of the tasks is randomly chosen from a hat, based on the global variable RandomizedTask, where in the value represents the assigned task. So how do I get Inform to generate a random number, between 0 and, say, 6? Or is there a more efficient/more reliable way of doing this?

That would be the random() function. Chapter 1.14.

(The index, it is useful.)

Right, but would it be something along the lines of random(1, 2, 3, 4)? I’m not able to check the ID4 or test it out right now.

Actually, that’s probably it…

It is online, actually: inform-fiction.org/manual/html/s1.html#s1_14

Oh, right. :blush: I assumed that it was only in PDF format…

The real problem is the random(x) command in I6 isn’t truly random. I’ve always thought that if I6 had some way of getting the current time, that the modulo of the current second would be pretty darn random for all intents and purposes.

In most interpreters it is tied either to the random() function in libc, or to a hand-coded pseudo-random number generator. Either is sufficient for IF purposes, and the distinction between their behavior and “truly random” is definitely not the problem that the original poster had.

But feel free to explain what you mean.