Ticket #4246 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Add ability to seed random number generators

Reported by: gemacke Owned by: gemacke
Priority: normal Milestone: 1.2
Version: 1.1.1 Severity: normal
Keywords: Cc:


This is a bit tricky because we can't do it consistently across all RNG libraries used by MTGL. We support 4 sources of parallel numbers: TRNG, C++11 RNG, XMT, and *rand48 / rand. TRNG, , C++11 RNG, and *rand48 / rand all use a single stream to generate RNGs and support seeding by passing a single number as the seed. The RNG for the XMT uses *rand48 for the serial generation and prand for the parallel. Thus, it uses two separate generation streams. Also, prand requires an array of 54 shorts as a seed. Cray documentation says not to seed the generator yourself unless you know what you're doing because the seeds need to work together to create non-overlapping sequences of numbers. Our solution is to have a seed function that take a single number and works as expected for TRNG, C++11 RNG, and *rand48 / rand. For the XMT the serial RNG will be seeded, but the parallel one won't. This is not optimal, but it seems to be a good compromise.

Change History

comment:1 Changed 3 years ago by gemacke

  • Status changed from new to accepted

comment:2 Changed 3 years ago by gemacke

  • Status changed from accepted to closed
  • Resolution set to fixed

Addressed in r4116.

Note: See TracTickets for help on using tickets.