For testing purposes, it's often useful to fix the random number generator so ink will produce the same outcomes every time you play. You can do this by "seeding" the random number system.
~ SEED_RANDOM(235)
The number you pass to the seed function is arbitrary, but providing different seeds will result in different sequences of outcomes.
Advanced: more queries
You can make your own external functions, though the syntax is a bit different: see the section on functions below.
RANDOM(min, max)
Ink can generate random integers if required using the RANDOM function. RANDOM is authored to be like a dice (yes, pendants, we said a dice), so the min and max values are both inclusive.
最近没有看这一块儿,但是文档中有这两部分内容:
SEED_RANDOM()
For testing purposes, it's often useful to fix the random number generator so ink will produce the same outcomes every time you play. You can do this by "seeding" the random number system.
The number you pass to the seed function is arbitrary, but providing different seeds will result in different sequences of outcomes.
Advanced: more queries
You can make your own external functions, though the syntax is a bit different: see the section on functions below.
RANDOM(min, max)
Ink can generate random integers if required using the RANDOM function. RANDOM is authored to be like a dice (yes, pendants, we said a dice), so the min and max values are both inclusive.
The random number generator can be seeded for testing purposes, see the section of Game Queries and Functions section above.
来源:https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md
根据不同版本的差异,如果您的版本不支持随机的话,还有一种变通方法,就是使用 Shuffles 来对预定义好的数据来进行随机选择:
参考:https://github.com/inkle/ink/issues/168