[tex-live] Random number primitives

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Nov 12 22:45:37 CET 2016

Hello all,

As many people will know, the LaTeX team have developed an expandable
FPU as part of expl3. That gets quite a bit of use, but one area we
can't currently address is random numbers. The pgf bundle has a
pseudo-random number generator, but that can't be expandable (you need
to track the seed). The usefulness of pseudo-random numbers has come up
a few times recently, and so we'd like to address this. (Expandable
floating point evaluation is pretty handy as an end user!)

Both pdfTeX and LuaTeX include a series of primitives that expose a
lower-level pseudo-random number generator (I assume from C: there is
very little actual code in the pdfTeX WEB source to implement these).
That gives us a way of providing expandable random numbers at the macro
level, but at present will be limited to those engines. As this is
something of an 'extra' (not core functionality), we will at present
accept that it's not doable in XeTeX/e-(u)pTeX (and issue an error if
requested), but it would be handy if the functionality could find its
way into those engines.

For reference, the 'full set' of primitives in this area is

- \(pdf)uniformdeviate
- \(pdf)normaldeviate
- \(pdf)randomseed
- \(pdf)setrandomseed

(LuaTeX drops the 'pdf' part of the names.)


More information about the tex-live mailing list