Difference between revisions of "Random"
Jump to navigation
Jump to search
m (Created page with "This page describes how to use random in ConTeXt and MetaPost. * {{cmd|getrandomnumber}}") |
m |
||
Line 1: | Line 1: | ||
− | This page describes how to use random in ConTeXt and MetaPost. | + | 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. |
− | * {{cmd|getrandomnumber}} | + | A number of related commands include: |
+ | |||
+ | * {{cmd|getrandomnumber}} - Generates a pseudo-random number each time. | ||
+ | * {{cmd|ctxlua}}<tt>{math.randomseed(os.time())}</tt> - Sets the seed based on the computer's timestamp. |
Revision as of 18:40, 5 October 2013
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.