Random Text from a list of 10 or so choices

Here's an advanced tip... be aware that duplicate lines don't increase the chance that that line is taken. For example, this code will have a 50% chance of producing "1" and 50% of producing "2"...

image

This is because the sort command makes its decision based on unique lines. Or more accurately, unique keys, which by default the sort command determines on a full-line basis.

A couple of years ago I thought I could increase the chance of a value being picked by increasing the number of times that the line occurred in the input text, and I discovered this issue at that time. I solved the problem by adding some random characters to each line.

1 Like