Refs:

Random numbers are hard to do well. Well, hard to make non-repeating and evenly distributed.

Heres one way to do it in liquid:

{ % capture time_seed % }{ { 'now' | date: "%s" } }{ % endcapture % }
{ % assign random = time_seed | times: 1103515245 | plus: 12345 | divided_by: 65536 | modulo: 32768 | modulo: 10 % }


blog comments powered by Disqus

Published

April 8 2015    -    21:21

Tags