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
7
votes
2 answers

Why does this random() distribution look asymmetric?

Edit: This is using Google Chrome 36 I was messing around with html5 canvas, generating points randomly distributed inside a cube and projecting that onto a 2D canvas. Surprisingly, the results don't look very symmetric at all, and I suspect that…
doeke
  • 462
  • 5
  • 12
7
votes
1 answer

Is OS X's SecRandomCopyBytes fork safe?

Many userspace CSPRNG's have an issue where after fork(2), it's possible for the two different processes to return the same stream of random bytes. From looking at dtruss, it's clear that SecRandomCopyBytes is, at a minimum, seeding from…
Alex Gaynor
  • 14,353
  • 9
  • 63
  • 113
6
votes
4 answers

Issues with seeding a pseudo-random number generator more than once?

I've seen quite a few recommendations for not seeding pseudo-random number generators more than once per execution, but never accompanied by a thorough explanation. Of course, it is easy to see why the following (C/C++) example is not a good…
Flygsand
  • 115
  • 1
  • 8
6
votes
9 answers

Pseudorandom generator in Assembly Language

I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external library. What is a good, simple pseudorandom number generator algorithm for…
TCJ
  • 95
  • 1
  • 2
  • 9
6
votes
2 answers

C++ thread-safe uniform distribution random number generation

I have a loop. Inside the loop, in each iteration, I need to draw a number from U[0,1]. How can I use openmp, and also make sure that the random number generating process is not contaminated? I got suggestion that I need a thread-safe random number…
Chen
  • 133
  • 1
  • 10
6
votes
1 answer

PHP - Pseudo Random Number Generator?

Over the past couple of days, I've been trying to find a good way to generate random numbers in PHP, based on a seed. Like I'm sure most of you already know, the php rand() method is way too random for some cases, and I really need a PRNG that lets…
user3490600
  • 255
  • 1
  • 3
  • 8
6
votes
2 answers

Which PRNG is suited for a functional usage?

This question is motivated by usage of a PRNG in Scala, but the answer can very well be language agnostic. Problem I want to have a functional interface to my PRNG. Currently the PRNG implementations I know (Java stdlib, Scala stdlib, commons math)…
ziggystar
  • 28,410
  • 9
  • 72
  • 124
6
votes
3 answers

Default seed PRNG in Java

I was wondering what the default seed for the PRNG* behind Math.random() in Java is. From what I understand the one in C is based upon the system clock. So is it similar in Java? Also, is the seed changed everytime Math.random() is called? *PRNG…
Yulfy
  • 395
  • 1
  • 4
  • 16
6
votes
3 answers

Is java.secure.random a sufficient choice for gambling industry?

Java provides an cryptographically secure random number generator in the package java.secure.random. Is it possible to use this number generator if I consider things like seeding and cyclic re-instantiation of the RNG? Or can I use the number…
pichsenmeister
  • 2,132
  • 4
  • 18
  • 34
6
votes
1 answer

Finding seeds for a 5 byte PRNG

An old idea, but ever since then I couldn't get around finding some reasonably good way to solve the problem it raised. So I "invented" (see below) a very compact, and in my opinion, reasonably well performing PRNG, but I can't get to figure out…
Jubatian
  • 2,171
  • 16
  • 22
6
votes
1 answer

What are good methods for hashing bits in an Int32 or UInt32?

I have an implementation of a pseudo random number generator, specifically of George Marsaglia's XOR-Shift RNG. My implementation is here: FastRandom.cs It turns out that the first random sample is very closely correlated with the seed, which is…
redcalx
  • 8,177
  • 4
  • 56
  • 105
6
votes
4 answers

What's the randomness quality of the Perlin/Simplex Noise algorithms?

What's the randomness quality of the Perlin Noise algorithm and Simplex Noise algorithm? Which algorithm of the two has better randomness? Compared with standard pseudo-random generators, does it make sense to use Perlin/Simplex as random number…
Zhen
  • 4,171
  • 5
  • 38
  • 57
6
votes
2 answers

Security of generating hash salts using PHP's mt_rand()?

I'm trying to generate blowfish hashes and I was wondering if it's safe enough to count on mt_rand() to generate my salts for me? function blowfish($string, $salt = NULL, $iterations = '08') { if( ! $salt) { $seed =…
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
5
votes
4 answers

JavaScript pseudo-random sequence generator

I need to generate a deterministic (i.e. repeatable) sequence of pseudo-random numbers given an initial seed and select the nth item from that sequence. If JavaScript's random function was seedable, I could just do: function randomNth(seed, seq) { …
Deebster
  • 2,829
  • 1
  • 26
  • 26
5
votes
2 answers

I need a portable, consistent pseudorandom number generator

I am writing a kid sister encryption function and I need a PRNG that produces consistent results across OSes (so no floating point math, taking advantage of hardware, or system level software). It would be nice, but not necessary, for the PRNG had…
Chas. Owens
  • 64,182
  • 22
  • 135
  • 226
1 2
3
15 16