From c2bf158ba0c0b99451e21a276153eab198425c72 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Sun, 18 Oct 2026 15:22:16 +0200 Subject: [PATCH] Add TinyMT64 as opt-in RNG_ALG=3 Mirror McCode's rng-gpu-mt-design header: _RNG_ALG_TINYMT 3 with a two-word uint64_t state. The generators live in McCode's runtime (mccode-r.c/.h), so this needs a runtime that provides them. KISS stays the default. Co-Authored-By: Claude Opus 5.5 --- src/mccode_antlr/translators/c_header.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mccode_antlr/translators/c_header.py b/src/mccode_antlr/translators/c_header.py index 8b3e04f..76d637c 100644 --- a/src/mccode_antlr/translators/c_header.py +++ b/src/mccode_antlr/translators/c_header.py @@ -158,6 +158,7 @@ def jump_line(instance, jump): /* available random number generators */ #define _RNG_ALG_MT 1 #define _RNG_ALG_KISS 2 + #define _RNG_ALG_TINYMT 3 /* selection of random number generator */ #ifndef RNG_ALG # define RNG_ALG _RNG_ALG_KISS @@ -166,6 +167,9 @@ def jump_line(instance, jump): #define randstate_t uint32_t #elif RNG_ALG == _RNG_ALG_KISS // KISS #define randstate_t uint64_t + #elif RNG_ALG == _RNG_ALG_TINYMT // TinyMT64 + #define randstate_t uint64_t + #define RANDSTATE_LEN 2 #endif #ifndef MC_NUSERVAR