How to generate a number between 1...n in Hugo
In Hugo you can use {{index (seq 18 | shuffle) 0}}.
- What this is doing is basically making a sequence, list, of numbers from 1-18 with
seq 18 - Mixing up the list by shuffling the elements with
shuffle - Then grabbing the first element by it’s index of zero
index (seq 18 | shuffle) 0
Originally mentioned in Dev Diary 0001 - Week of October 2nd 2023
Dispatches from the fleet
What passing ships signaled back
Unfurl the messages