HUGO

Shuffle with seed

Hello,

Is there a way to set the seed for the shuffle function?

Thank you very much,
Kiru

Currently no.

@kiru - If it helps, I’ve done this in the past. It will generate a new string on each build.

Code:

{{ $seed := "foo" }}
{{ $random := delimit (shuffle (split (md5 $seed) "" )) "" }}
{{ $random }}

Output:

5b16c8cffebcc48ac4d2ad4dcfc54ed8
d45ac5c6ce8c8fdcff8dbdbace44421c
...

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.