Get Random Number Using Liquid

Code Snippet / Tutorials

2019.11.01

Get Random Number Using Liquid

Generate random numbers in Liquid was once possible with built-in rand(), but it has been taken out because it's easy to replicate in JavaScript and doesn't benefits to server side caching. However, you can actually get a random number in Liquid through a simple trick: making use of both the date & modulo Liquid filters.

Ads by Google
Ads by Google