Generate random numbers in Liquid was once possible with built-in
For example in a Jekyll project, get a random number like follows:
- Get the current date, using
- Extract the nanoseconds value from the date, using
- Use the module filter to get the random number between the min & max settings;
- Eventually, add the min value to the result.
And here is an example, generate a random number between 50 to 100:
randomNumber is actually fixed because the
site.time is fixed once you start building the static files. It’s only random among different builds. You can, just replace the
site.time with anything that can be converted into intergers. So, I’ve decided to use the
page.content | size to replace the
site.time at present for a pseudo random number.
Did you know that you can generate numbers in SCSS?
random(param:max)is available in SCSS.