What is the best way to get a random number within a certain range?
I made something but I guess there is a better way:
In this example I want to position some elements randomly. This approach works, but I have to define a variable for each value.
{% set randomizr = range(10, 90) %}
{% set randomHeight1 = shuffle(randomizr) | first %}
{% set randomWidth1 = shuffle(randomizr) | first %}
{% set randomHeight2 = shuffle(randomizr) | first %}
{% set randomWidth2 = shuffle(randomizr) | first %}
{% set randomHeight3 = shuffle(randomizr) | first %}
{% set randomWidth3 = shuffle(randomizr) | first %}
{% set randomHeight4 = shuffle(randomizr) | first %}
{% set randomWidth4 = shuffle(randomizr) | first %}
{% set randomHeight5 = shuffle(randomizr) | first %}
{% set randomWidth5 = shuffle(randomizr) | first %}
<div class="sandbox">
<div style="left: {{ randomHeight1 }}%; top: {{ randomWidth1 }}%;"></div>
<div style="left: {{ randomHeight2 }}%; top: {{ randomWidth2 }}%;"></div>
<div style="left: {{ randomHeight3 }}%; top: {{ randomWidth3 }}%;"></div>
<div style="left: {{ randomHeight4 }}%; top: {{ randomWidth4 }}%;"></div>
<div style="left: {{ randomHeight5 }}%; top: {{ randomWidth5 }}%;"></div>
</div>
Is this somehow possible without writing each variable manually?