Template Tag for Random Selection of Any Line
These are template tags meant to support the construction of text in a random or seeded random (reproducible) way. Two tags are provided: `seed_randomization` and `any`. Only seed the randomization if you wish to have the options generated the same way each time. Only necessary once per request, if done early enough in the rendering process. Example without seeding: <p> {% any %} One day Once upon a time In a galaxy far, far away {% endany %} a young foolish {% any %}programmer|lawyer|Jedi{% endany %} {% any %} set out began his quest ran screaming {% endany %} to pay his stupid tax. </p> # Possible outcomes: <p>In a galaxy far, far away a young foolish lawyer set out to pay his stupid tax.</p> <p>One day a young foolish programmer ran screaming to pay his stupid tax.</p> Be sure to read the documentation in the code.
- tag
- django
- random