lundi 19 octobre 2015

Using bash to create random contiguous number sequences from a given range

Using a given range of values, I'm trying to generate random instances of three contiguous numbers.

For example, given the range 1-100, and desiring three (non-overlapping) random instances of three contiguous numbers, the output would be something like:

4 5 6
50 51 52
32 33 34

I've been trying to use the command shuf, for example,

shuf -i 1-100 -n 3

but this doesn't seem to permit the generation of random contiguous number sequences. Any ideas?




Aucun commentaire:

Enregistrer un commentaire