1
$\begingroup$

I am trying to implement and optimize the Tiny Mersenne Twister (TinyMT) algorithm as required by an API I am developing with my team at work. The algorithm utilizes a C structure with 32-bit unsigned integers "mat1", "mat2", "tmat", and an array called "status" which is four 32-bit unsigned integers wide.

I am relatively new to the subject of random number generation; however, I have been able to teach myself a lot about the subject over the past couple of weeks. I know what the purpose of a seed is, different methods such as linear congruent, LSFR, GFSR, etc. So I've been doing my "homework" and researching the topic to the best of my ability (contrary to what the guys at Stack Overflow think). Unfortunately, the Mersenne Twister in general is extremely poorly documented and very few documents exist to explain the code and math side-by-side. The TinyMT's documentation is even worse, it's virtually non-existent! So developing accurate Doxygen comments for this part of the API is going to be tricky.

With that said, hopefully somebody more qualified than I can help me out here. What is the significance of the aforementioned parameters? What do they do, what do they mean, what do they stand for, etc? My guess would be as follows:

  • mat1 - Matrix 1
  • mat2 - Matrix 2
  • tmat - Tempering Matrix
  • status - 127 bit wide "seed" (where the last bit goes, I'm not sure)

Given that the user provides values for "mat1", "mat2", and "tmat," are there any precautions they need to take before supplying values for them? Again, this is for an API and its documentation, so I would like to be able to give the customers a good idea of what they need to use the RNG and hopefully make the lives of other fellow programmers easier. Thanks!

$\endgroup$

migrated from cstheory.stackexchange.com Jun 26 '13 at 0:52

This question came from our site for theoretical computer scientists and researchers in related fields.

3
$\begingroup$

You can generate parameters for the PRNG using the provided program tinymt32dc. You should generate these parameters once and for all for each application. Each time you call the PRNG, you use the same parameters but a different seed. The reason that you don't want to vary the parameters is that generating them is (apparently) time consuming, while initializing the PRNG from just the seed is designed to be quick.

There might be some constraints on these parameters, but since you're not the designer of TinyMT, you're not aware of them. Instead, you should just use the provided program that generates legal parameters.

$\endgroup$
  • $\begingroup$ ok, so all parameters except the seed must be chosen carefully by the other program basically? $\endgroup$ – audiFanatic Jun 26 '13 at 14:56
  • $\begingroup$ Right. These are the usage notes coming with the cipher itself. $\endgroup$ – Yuval Filmus Jun 26 '13 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.