I ended up implementing DRBG_HMAC in Ruby. The code can be found here: https://github.com/cryodex/drbg-rb

If you need bit k (k = 0 ..15), you can do the following: return (lfsr >> k) & 1; This shifts the register kbit positions to the right and masks the least significant bit....

Unless you are prepared to break new ground in number theory, you would only be able to detect obsolete, badly designed, or poorly seeded PRNGs. Good PRNGs are explicitly designed to prevent what you are trying to do. Random number generation is a critical part of digital cryptography, so a...

Yes, it's an instruction-level parallelism thing. Basically such a CPU will have more execution hardware available than is needed for each individual instruction, so it "spreads out" a bunch of instructions over the available resources, then merges the results back so that, to the programmer, it still looks like things...

c#,probability,prng,roulette-wheel-selection

Maybe i'm not understanding it correctly but I'm guessing the problem lies here : while (true) { foreach (var entry in numbers) { if (entry.Size > rng.Next(size)) { return entry.Number; } } } You're calculating the rng.Next each time you do the if check. So the first number has a...

I get the same results as you do, but no duplicates ;p What I mean is that if I run your program as directed I get 68 duplicates, but if I switch randdouble() => randui32() there are no more duplicates, so I'll bet they were an artifact due to the...

Use a ternary and a reference: std::mt19937& ref = flag ? rng : local; Here, flag is the condition to test, rng is the "global" random object, and local is the more localised one. Binding a reference to the result of a ternary is syntactically valid: you can't do it...

With random number generators it is always hard to say which is best. Linux and most Unixes have a pretty well thought out random number generator, so it doesn't hurt to use /dev/random or /dev/urandom, i.e. "NativePRNG". Problem with using /dev/random is that it blocks until enough entropy is available....

c++,c++11,random,distribution,prng

Interesting question. So I was wondering if interfering with how the distribution works by constantly resetting it (i.e. recreating the distribution at every call of get_int_from_range) I get properly distributed results. I've written code to test this with uniform_int_distribution and poisson_distribution. It's easy enough to extend this to test another...

What you want is a randomly "ordered" list, not a randomly "generated" list. This is usually called "Shuffling". Here's some sample code (not good code by any means, but I made it as close as yours as a sample) to achieve what you want: static void Shuffle(int[] list) { var...

Holy questions batman. Hopefully I'm not too late to the party. But how do you actually go about exploiting the pRNG? That depends on the system using it, and what(if any) advantage is to be gained from knowledge of the next random number. Do you have to watch the output...

What you need is the equation to convert from a uniform distribution (random-float) to the distribution you want. This might be a better question for the stackexchange stats. However, according to Wikipedia, the formula is: $$ T = \frac{m}{U^\frac{1}{\alpha}} $$ where $U$ is the uniform input, $T$ is the Pareto...

c++,random,prng,mersenne-twister

This happens because the return value of newr() and newr.max() are integers and the value returned by newr() is smaller than newr.mar(). The result of the division is a zero integer which is then converted to a double. To fix this use rn = static_cast<double>(newr()) / newr.max(); ...

rand() uses the previous random value as the new seed on subsequent calls. This is why a unique random sequence of values will be generated when you start with a different seed value.

c,random,prng,mersenne-twister

Normally, any bit should be random, this is a property of the Mersenne twister. However (I do not know MT very deeply) you may have long-term dependence between some bits. It is recommended to use the library functions for setting the integer range, rather than arranging the bits yourself, or...

You have incorrect syntax. Please see the following line: unsigned int rand(); { This line should read: unsigned int rand() { Edit In your test code, you have the following: int interrupt(TIMERA1_VECTOR) blink_LED (void) { I have never seen an interrupt service routine defined in this way. Instead it should...

c++,boost,prng,mersenne-twister

I don't know the underlying implementation of urand(), but using the result of a division is likely to produce bias in the low-order bits as a quantisation effect. If gen.max() isn't large then "low-order bits" may be very many or most of the bits of the result. The performance disparity...

Automatic simplification is turning your, GenerateFloat()^2+GenerateFloat()^2 into, 2*GenerateFloat()^2 before GenerateFloat() is evaluated. One simple change to get it to work as you expected would be separate them. Eg, restart: with(RandomTools[MersenneTwister]): tries := 10^4: s := 0: for i to tries do t1,t2 := GenerateFloat(),GenerateFloat(); if t1^2+t2^2 < 1 then s...

java,ios,swift,compatibility,prng

Okay - here is the solve: I asked the same question in the Apple forums and a nice person by the handle of 'ahltorp' shared a c function that they had been using for the very same thing. It's swift compatible and I have tested it against my simulation and...