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

Create programmatic colour picker

How would one create a deterministic Javascript HTML colour picker which given arguments of how many colours are desired returns an array of HTML hex colour codes, ie: function createColours(numColours) { return [/* colours array of size…
j pimmel
  • 11,617
  • 6
  • 33
  • 43
2
votes
4 answers

Generate Array of Numbers that fit to a Probability Distribution in Ruby?

Say I have 100 records, and I want to mock out the created_at date so it fits on some curve. Is there a library to do that, or what formula could I use? I think this is along the same track: Generate Random Numbers with Probabilistic…
Lance
  • 75,200
  • 93
  • 289
  • 503
2
votes
2 answers

Cryptographically secure PRNG (PseudoRandom Number Generator)

What is the best and fastest algorithm to generate cryptographically secure PRNG? My requirements is as follows. In each run, I need to generate few millions of numbers with length of 10. It should not allow one to predict future iterations by…
Parvin Gasimzade
  • 25,180
  • 8
  • 56
  • 83
2
votes
3 answers

ios Swift: looking for a cross compatible method to Java's Random() PRNG that has identical output

Here's my delimna: I am writing an application that needs to exactly reproduce the PRNG output from a game that was written in Java that uses the Java random() with a given seed to create all it's initial game 'world' data. The problem I am…
dano
  • 31
  • 4
2
votes
2 answers

Seeding Python's PRNG with a tuple

I notice that if I seed Python's PRNG with a tuple, I get different results each time I do it. That is, the Python 3.4 program: import random seed1 = ('Foo', 'Bar') random.seed(seed1) print(random.random()) prints a different number each time it is…
xnx
  • 24,509
  • 11
  • 70
  • 109
2
votes
5 answers

Generating a Pseudo-random sequence of plus/minus 1 integers

Can anybody help me create a simple pseudo-random sequence of +-1 integers with length 1000 using Matlab? I.e. a sequence such as -1 -1 1 1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 I tried using this code below but this is the RANGE -1 to 1, which…
bonapart3
  • 469
  • 7
  • 20
2
votes
2 answers

std::mt19937 doesn't return random number

I have the following piece of code: unsigned int randomInt() { mt19937 mt_rand(time(0)); return mt_rand(); }; If I call this code, for example 4000 times in a for loop, I don't get random unsigned integers, instead I get for example 1000…
marc3l
  • 2,525
  • 7
  • 34
  • 62
2
votes
0 answers

Encryption with Android 4.2 and earlier versions - PRNGFixes

I need to encrypt password, but for Android 4.2 and below version, my solution doesn't work, The encrypted password is random. it's due to PRNG. So I saw this post : https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html I…
NonowPoney
  • 982
  • 4
  • 14
  • 30
2
votes
1 answer

How to create a "random-pareto" in NetLogo?

Since I am not well-versed in mathematics, I am struggling with the implementation of a random number generator in NetLogo which follows roughly a pareto distribution. This is the follow-up question of this one here, where I would like to substitue…
Til Hund
  • 1,543
  • 5
  • 21
  • 37
2
votes
2 answers

several random numbers c++

I am a physicist, writing a program that involves generating several (order of a few billions) random numbers, drawn from a Gaussian distribution. I am trying to use C++11. The generation of these random numbers is separated by an operation that…
contrariwise
  • 117
  • 1
  • 10
2
votes
2 answers

How to use Intel Ivy Bridge's RNG?

I read that Intel Ivy Bridge processors provide a RNG (RdRand). But how do I use this? My CPU E3-1270v2 does not provide a RNG flag. flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse…
user1091344
  • 612
  • 6
  • 27
2
votes
2 answers

What is the time complexity of the Mersenne twister?

I have read that "the computational complexity of the Mersenne twister is O(p2) where p is the degree of the polynomial". What does this mean? Which polynomial is this referring to? Also, is computational complexity another way of saying time…
hannah
  • 889
  • 4
  • 13
  • 27
2
votes
5 answers

Generate random integers from random bit sequence

Very basic question but I can't seem to find the answer on Google. A standard PRNG will generate a sequence of random bits. How would I use this to produce a sequence of random integers with a uniform probability distribution in the range [0, N)?…
jcai
  • 3,448
  • 3
  • 21
  • 36
2
votes
1 answer

Seedable CSPRNG in Ruby

Does Ruby provide functionality to run a seedable CSPRNG? From the standard library, OpenSSL/SecureRandom is cryptographically secure, but not seedable. Random is seedable, but not cryptographically secure. Alternatively, what is a secure way to…
user2398029
  • 6,699
  • 8
  • 48
  • 80
2
votes
2 answers

Generating Doubles With XORShift Generator

So I am using the Wikipedia entry of XORShift Generators to make a PRNG. My code is as follows. uint32_t xor128(void) { static uint32_t x = 123456789; static uint32_t y = 362436069; static uint32_t z = 521288629; static uint32_t w =…
CMilby
  • 624
  • 1
  • 6
  • 23