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

integer array won't print

I created this method randomInt, that gives a random number, between -5, and 15. I created another method randomIntArray that calls randomInt, in a loop, and stores the random integers into an array. However, when I try to print it, it just returns…
theUser
  • 91
  • 5
0
votes
3 answers

Keep uniform distribution after remapping to a new range

Since this is about remapping a uniform distribution to another with a different range, this is not a PHP question specifically although I am using PHP. I have a cryptographicaly secure random number generator that gives me evenly distributed…
NotGaeL
  • 8,344
  • 5
  • 40
  • 70
0
votes
1 answer

What PRNG is Unity3D using?

I am designing an application with some security implications in Unity3D and deploying to iOS and Android. This got me wondering what PRNG unity is using when calling functions in the Random module. Since the module has to be seeded, it is clearly a…
0x90
  • 6,079
  • 2
  • 36
  • 55
0
votes
2 answers

How do you implement a polynomial in a LFSR? (VHDL)

So I am trying to make a 8-bit PRNG using a LFSR but I am told to use a specific polynomial(X^8 + x^3 + 1). How exactly do I implement this polynomial? I need help understanding how I can design a PRNG using a LFSR.
bzrk89
  • 55
  • 3
  • 9
0
votes
1 answer

xorshift128+ PRNG implementation in java w/o unsigned long

Using this C code for reference (sourced from http://en.wikipedia.org/wiki/Xorshift): uint64_t s[2]; uint64_t xorshift128plus(void) { uint64_t x = s[0]; uint64_t const y = s[1]; s[0] = y; x ^= x << 23; // a x ^= x >> 17; // b …
lgp
  • 325
  • 4
  • 12
0
votes
1 answer

modulo with unsigned int

In C++ i try to use modulo operator for two unsigned int variables like in Marsaglia's multiply with carry algorithm. The results seem right, but i'm not sure about the limitations of modulo. m_upperBits = (36969 * (m_upperBits & 65535) +…
Meldryt
  • 75
  • 1
  • 10
0
votes
1 answer

How to obtain the seed used by Haskell's RNG?

I am using the following Haskell code to write a file of one million pseudorandom bits: import System.Random rbits= do g <- getStdGen writeFile "haskellbits.txt" (take 1000000 (randomRs ('0', '1') g)) However, I am also interested in writing…
0
votes
2 answers

Pseudo Random Number Generator C#

Random randomSeed = new Random(); int seed = randomSeed.Next(255); String display = ""; int min = 1; int max = 10; int number; Random rand = new Random(seed); for (int i = 0; i < max; i++) { number = rand.Next(min, max); …
bluecelcius
  • 13
  • 1
  • 3
0
votes
2 answers

Random real in [0..1[ using Mersenne Twister

I'm trying to make a model of a zombie apocalipse in c++ using simple structs and a when I'm randomizing the population, I need some fields of the struct to have a value in the interval [0..1[. As I'm interested in a more statistically correct…
Pedro
  • 333
  • 1
  • 5
  • 24
0
votes
0 answers

Implement glibc random number generator in Windows

I have an embedded device using the standard glibc srand()/rand() functions to generate pseudo-random values. For the same seed x I need to get the same values for rand() on a Windows machine. To my surpise however, this isn't as simple as it…
Peter Van Akelyen
  • 127
  • 1
  • 1
  • 6
0
votes
1 answer

WELL PRNG not working?(maybe)

I am trying to use a specific implementation of the WELL PRNG, supposedly better than the original. link to the code However I am having some trobles with it. No matter how I seed it, it just outputs the same numbers. I think that I am probably just…
uLoop
  • 225
  • 1
  • 8
0
votes
2 answers

Are true random values generated in the past and stored still considered random?

Pretend I have a client service that needs true random Integer values (4 bytes) every 10 seconds. As such, I acquire a piece of hardware that generates true random values based on atmospheric noise. The device can generate up to 8 bytes of random…
hbCyber
  • 773
  • 8
  • 17
0
votes
1 answer

Best way to maintain an RNG state in multiple devices in openCL

So I'm trying to make use of this custom RNG library for openCL: http://cas.ee.ic.ac.uk/people/dt10/research/rngs-gpu-mwc64x.html The library defines a state struct: //! Represents the state of a particular generator typedef struct{ uint x; uint…
user1855952
  • 1,515
  • 5
  • 26
  • 55
0
votes
1 answer

PRNG Error (Python)

So I'm trying to make a PRNG: import math; import datetime; print("Please input the seed number.") seed = input() systime = datetime.datetime.now().time() int result = seed + 24252561651525166 - 4551512245 * 1526125162612222525 + tan(pow(seed, 2) +…
Axmill
  • 305
  • 1
  • 2
  • 6
0
votes
1 answer

Is there a way to test the quality of a PRNG for multidimensional use?

I'm in the process of evaluating some PRNGs, both in terms of speed and quality. One aspect of quality I want to test is multidimensional distribution and bias. I know of TestU01's batteries, and I plan on using them (and, perhaps, others that the…
Cornstalks
  • 37,137
  • 18
  • 79
  • 144