Random

From Wiki
Revision as of 18:40, 5 October 2013 by Thangalin (talk | contribs)
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.

A number of related commands include:

  • \getrandomnumber - Generates a pseudo-random number each time.
  • \ctxlua{math.randomseed(os.time())} - Sets the seed based on the computer's timestamp.