ConTeXt and Lua programming/Random numbers
Jump to navigation
Jump to search
This page describes how to use random (to produce pseudo-random values) in ConTeXt and MetaPost.
The uniformdeviate
function in MetaPost, by default, uses a seeded value. This is useful to generate the "same" random results each time the final product is generated, but hampers creating books that differ from each other on successive generations.
The random seed is stored in the tuc
file so that you get the same output each time the file is compiled (otherwise, multiple compiles can lead to an infinite cycle and you may not get all the references correct).
If you want to update the random seed, you have to delete the tuc file between runs:
context --purgeall my_file.tex
See the \getrandomnumber command for details.