168 questions
2
votes
1
answer
125
views
Seeding value in PHP
I was going through this article
https://www.ambionics.io/blog/php-mt-rand-prediction
which claims that if we use mt_rand(), we can get the seed value using two values instead of brute forcing.
In the ...
1
vote
0
answers
281
views
How to decode the format of the output of this Mersenne Twister cracking program?
Recently, I came across this article which seemed pretty interesting and it talks about ways to crack Mersenne Twister. Essentially, at the end of the article we have an binary and Assembly source ...
1
vote
0
answers
108
views
Mersenne vs Rand: Why do I get more total consecutive repetitions when using Mersenne compared to Rand? C++
I have this algorithm for shuffling, I am trying to replace the Rand with Mersenne as an enhancement since Mersenne is more efficient and produces much randomness compared to rand according to what I'...
0
votes
0
answers
148
views
Is initializing the internal state of a PRNG time consuming?
I wrote and tested the following program (i.e. timed it using strace -c command) and there was no meaningful difference between the execution times of the one that fully seeds the engine and the other ...
0
votes
0
answers
278
views
How to get current seed from current state in R?
How can I get the current seed from the current RNG state in R? For instance,
a <- 1987
set.seed(a)
b <- .Random.seed
How can I retrieve a (i.e., 1987) from b? Thank you.
3
votes
0
answers
305
views
R pseudo-random number generation change with same seed set with set.seed on 2 different machine
Issue:
On R, running the function below leads to different seeds generation (and different set of random number) on 2 different machines but with the same starting seed with Mersenne-Twister algorithm:...
0
votes
1
answer
1k
views
clang ignores -std=c++11 flag for include files
I have some code that I use a (old) Mersenne Twister header file with to get a good pseudo-random number generator.
The problem is that that code uses the register keyword which (as far as I ...
0
votes
1
answer
108
views
Why is rand() % N sufficient for small distributions?
I've often heard that you should never mod the result of your random number generator if you want a uniform distribution. However, I've seen that using a std::uniform_int_distribution makes no ...
0
votes
1
answer
303
views
Should this number be subtracted by 1 when implementing the Mersenne Twister?
I found this snippet online along with this Stackoverflow post which converts it into a TypeScript class.
I basically copy and pasted it verbatim (because I am not qualified to modify this sort of ...
0
votes
1
answer
357
views
Why is the Mersenne twister prefered to using the wichmann hill algorithm to produce pseudo random numbers?
I read that in version by Python 2.3 https://stackless.readthedocs.io/en/2.7-slp/library/random.html the Mersenne twister replaced the Wichmann-Hill method as default generator. I was wondering if ...
0
votes
0
answers
82
views
how to convert GCCRandom(Mersenne Twister by Takuji Nishimura and Makoto Matsumoto) from Game Coding Complete by Mike McShaffry 4E to stl random
I am trying to translate the book Game Coding Complete by Mike McShaffry 4E to modern C++17 standard and faced with the code of Mersenne Twister by Takuji Nishimura and Makoto Matsumoto.
Is it right ...
0
votes
0
answers
182
views
Generating different sequences of random numbers for different threads with Mersenne Twister (C++)
I have a Monte Carlo code and need to run many simulations in parallel using MPI. I would like to be sure that the numbers that are generated in each simulation belong to a different sequence.
Here is ...
2
votes
2
answers
733
views
Generate random long long C++
int generator
I currently generate deterministic pseudo-random ints using this code:
#include <chrono>
#include <ctime>
#include <random>
#include <stdint.h>
const uint32_t ...
1
vote
1
answer
331
views
Visual Studio 2019 c++latest generic URNG function fails to compile after latest update
I have the following generic C++ generic URNG function:
template<class URNG>
void TestURNG(URNG& urng)
{
// Uniform distribution used with vector
// Distribution is [-5, 5] ...
0
votes
0
answers
104
views
Storing random_device seeds for Monte Carlo simulations
On C++, I am using random_device to seed my 64-bit mersenne twister as follows:
random_device rand_dev;
mt19937_64 mersenne_generator(rand_dev());
And then calling the distribution function inside ...