Questions tagged [prng]

PRNG - Pseudorandom number generator, A pseudorandom number generator (PRNG), also known as a deterministic random bit generator (DRBG),[1] is an algorithm for generating a sequence of numbers that approximates the properties of random numbers.

See more about PRNG on wikipedia.org

232 questions
5
votes
1 answer

What platforms offer SystemRandom?

Python's random.SystemRandom provides cryptographic-quality pseudorandom numbers. What platforms is it supported on? Most importantly, are there any platforms that it is not supported on, and if so, which ones? Can anyone provide any information…
D.W.
  • 3,382
  • 7
  • 44
  • 110
5
votes
4 answers

How to test PRNG?

Lately I implemented a MersenneTwister for 64-bit integer (or long). Is there a guide or examples of how to test PRNG so that I may know whether or not my implementation is good-enough solution. I'm specially interested into how to verify if my…
Daniel Fath
  • 16,453
  • 7
  • 47
  • 82
5
votes
1 answer

How do I switch between local and global settings for the initial state of a C++11 RNG?

In the code given below, I would like to implement a flag (or something equally simple) that has the same effect as commenting out the local setting and using the global setting some times (yielding two different numbers in this example), and using…
PeteL
  • 61
  • 4
5
votes
2 answers

mt19937 and uniform_real_distribution

I am trying to find an efficient way to implement a uniform(0,1) distribution. Since I have to generate a very large number of samples, I chose mt19937 as engine. I am using the version from the boost library. My question is: what is the difference…
user3278488
  • 95
  • 1
  • 6
5
votes
2 answers

Is it safe to take only a few bits from a number obtained with a Mersenne Twister

I have to work with some code produced by an employee that is now retired, and I have some few strange things concerning random numbers. At some points, he shifted the value returned by a PRNG 10 bits to the right and then use a mask on this value.…
Loufylouf
  • 697
  • 5
  • 13
5
votes
2 answers

What is the difference between using std::random_device with pRNG e.g. std::mt19937 and without?

In C++11 one can generate numbers with the use of std::random_device with or without a pseudo random number generator like mt19937. What will be the difference using this in this exemplar code: #include #include int main() { …
Patryk
  • 22,602
  • 44
  • 128
  • 244
5
votes
2 answers

How to use Stanford PRNG to generate a random string?

I need to generate a secure 50 characters random string in the users browsers. Looking at sjcl.prng I've got this so far: $(document).ready(function () { sjcl.random = new sjcl.prng(8); sjcl.random.startCollectors(); …
Martijn19
  • 189
  • 4
  • 13
5
votes
2 answers

Cycle of SecureRandom of Java

PRNGs usually have a cycle after which the generated random numbers do repeat. What's the cycle of SecureRandom of Java when the instance of SecureRandom is created as follows: SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
5
votes
1 answer

Read Intel DRBG parameters

Newer Intel processors include a DRBG, which generates random numbers which you can read with the RDRAND instruction. It involves a 256-bit seed S generated from a hardware entropy source dependant on noise in a metastable oscillator. The…
Falcon Momot
  • 1,065
  • 8
  • 20
5
votes
2 answers

Alternative Cryptographic Secure Pseudo Random Number Generator for C#

After all this NSA stuff I was just wondering if anybody knows alternatives to the System.Security.Cryptography.RNGCryptoServiceProvider() from .NET - maybe an Open Source solution? I tried to search for it, but wasn't really successful, so I hope…
Chris
  • 612
  • 7
  • 16
5
votes
1 answer

How to seed the PRNG for BN_generate_prime

I have not been able to find an answer as to what is used to generate the primes with BN_generate_prime in openssl/bn.h. Also, how would I seed whatever PRNG that this function uses? Separate question but relevant to my code (I'm writing a program…
thaweatherman
  • 1,467
  • 4
  • 20
  • 32
5
votes
1 answer

What makes the Mersenne Twister Tempering function reversible?

It is well known that it is possible to reverse the MT tempering function. Source code is available online to do this here. I'm trying to figure how this works and how I would approach this and similar problems in a programmatic fashion. What I'm…
spinlock
  • 108
  • 7
5
votes
5 answers

Generating a random double between a range of values

Im currently having trouble generating random numbers between -32.768 and 32.768. It keeps giving me the same values but with a small change in the decimal field. ex : 27.xxx. Heres my code, any help would be appreciated. #include…
Olivier
  • 1,981
  • 7
  • 24
  • 29
5
votes
2 answers

Random access encryption with AES In Counter mode using Fortuna PRNG:

I'm building file-encryption based on AES that have to be able to work in random-access mode (accesing any part of the file). AES in Counter for example can be used, but it is well known that we need an unique sequence never used twice. Is it ok to…
Maksee
  • 2,311
  • 2
  • 24
  • 34
5
votes
2 answers

Can a cryptographic hash algorithm be used as a PRNG?

Can MD5/SHA256/SHA512, etc., be used as a PRNG? E.g., given an integer seed, is the pseudo-code: random_number = truncate_to_desired_range( sha512( seed.toString() + ',' + i.toString() ) …a decent PRNG? (i is an increasing integer, e.g., the…
Thanatos
  • 42,585
  • 14
  • 91
  • 146