McXtrace logo

McXtrace - An X-ray ray-trace simulation package

Synchrotron SOLEIL DTU Physics

McXtrace

About McXtrace
 Publications
 Project Partners
 Project People
 Goal

Download
 Components

Mailing list

Search

Documentation
 Manual
 Commands
 Wiki (GitHub)
 Tutorial

Links

Report bugs (GitHub)

Code-repository (GitHub)


Random generators

A.2  Random generators

As of McXtrace 3.x, the default random number generator is a 64-bit adaptation of Marsaglia’s KISS (“Keep It Simple Stupid”) generator, a composite of a linear congruential generator, a xorshift generator, and a multiply-with-carry generator, combined to give a very long period (\(>2^{127}\)) while remaining fast and simple. Crucially, KISS runs identically on both CPU and GPU/OpenACC, which is why it replaced the previously used Mersenne Twister as the default: Mersenne Twister’s large internal state does not parallelize well and is currently not functional for GPU-accelerated simulations.

The classic ”Mersenne Twister” generator, by Makoto Matsumoto and Takuji Nishimura[MN98] (see
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for the original source), remains available as a build-time alternative for CPU-only simulations, selected by compiling the generated instrument with -DRNG_ALG=1 (e.g. via the MCXTRACE_CFLAGS environment variable, or the C-compiler flag options). It has an extremely large period (\(2^{19937}-1\)) and negligible cross-correlations up to 623 dimensions, but should not be selected for GPU/OpenACC runs.


Last Modified: Monday, 02-Nov-2026 22:21:08 CET
Search website mailinglist archive GitHub repos