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
1 answer

Ruby's SecureRandom and the size of n

I'm looking for 6 random hex characters, and am using Ruby's SecureRandom SecureRandom.hex(3) will return 6 hex characters unpacked from 3 bytes of random data. The question is, will doing SecureRandom.hex(6)[0,6] return 6 hex characters that are…
danivovich
  • 4,197
  • 4
  • 30
  • 31
0
votes
3 answers

Random Number Generator Algorithm

What algorithm is used by banks for generating random numbers like(credit cards/debit cards numbers) ? Suppose i maintain all the numbers in DB and If i try the below approach, Generate a random number. Verify whether the number has been already…
josh
  • 13,793
  • 12
  • 49
  • 58
0
votes
6 answers

How can I generate unique random numbers in PHP?

I am working on a MCQ module and I need to fetch random questions from my database. The problem is that I seem to get duplicates.
PROFESSOR
  • 884
  • 3
  • 13
  • 20
0
votes
1 answer

PRNG uniform distribution

Can someone please help me wrap my head around this problem Given X number of servers that generate some message and a simulation duration of T seconds, at what time intervals should each server generate a message, so that on an average, there are…
Jimm
  • 8,165
  • 16
  • 69
  • 118
0
votes
3 answers

Recommendation Needed for a PRNG

I'm looking for a Pseudo-Random Number Generation algorithm capable of producing a random 128-/256-bit number. Security and cryptographic integrity are not important; simplicity and performance are valued above all else. Ideally, the algorithm will…
Dan
  • 1
0
votes
1 answer

Psuedo-Random-Number-Generator from a computable normal number

Isn't it easily possible to construct a PRNG in such a fashion? Why is it not done? That is, as far as I know we could simply have a PRNG that takes a seed n. When you ask for a random bit, it takes the nth digit of the binary expansion of the…
Devin Jeanpierre
  • 92,913
  • 4
  • 55
  • 79
0
votes
3 answers

having trouble understanding this PRNG code in C

#include double seed=0.579832467; main(ac, av) int ac; char *av[]; { /* declare variables */ float *buf, fac; int sf, ne, i; /* prototypes? ( shouldn't they be outside the main ) */ double rnd(), sd; /* gets the…
wsavran
  • 327
  • 1
  • 2
  • 9
0
votes
1 answer

Scaling Int uniform random range into Double one

Actually, I have several interweaving questions. (If it matters I use C#.) First. I have a prng that generates random numbers in UInt32 range, from 0 to UInt32.Max inclusive. I want to preserve the uniformity as much as possible. What is the main…
Yuri
  • 53
  • 1
  • 4
0
votes
3 answers

Is user delay between random takes is good improvement for PRNG?

I thought that for making random choices for example for next track in a player or next page in the browser it could be possible to use time as 'natural phenomenon', for example decent RPNG just can continuously get next random number without…
Maksee
  • 2,311
  • 2
  • 24
  • 34
0
votes
1 answer

Random variable-length encoded numbers with uniform distribution

Suppose I have data presented with variable-length encoding when I can retrieve the data parsing some virtual b-tree and stopping when I reach the item (similar to Huffman encoding). There is unknown number of items (in the best case only the upper…
Maksee
  • 2,311
  • 2
  • 24
  • 34
0
votes
0 answers

Does srand() reproduce results between iOS devices?

I want to shuffle a hard-coded list of values, and be able to get the same result across devices. So, I thought that instead of sending the shuffled list's values, send only a number to initialize rand(). Would it work? Do srand() and rand() work…
Aviad Ben Dov
  • 6,351
  • 2
  • 34
  • 45
0
votes
1 answer

Galois LFSR - how to specify the output bit number

I am trying to understand how change the galois LFSR code to be able to specify the output bit number as a parameter for the function mentioned below. I mean I need to return not the last bit of LFSR as output bit, but any bit of the LFSR ( for…
Illania
  • 117
  • 1
  • 1
  • 14
0
votes
1 answer

Modified SHA256 for PRNG seeding

Can I do this 1. Copy SHA hash constants to eight 32bit work variables. 2. Expand message. 3. Mix work variables (SHA inner loop). 4. Output work variables to PRNG state. instead of the normal procedure (single message block) 1. Pad message…
Thorham
  • 447
  • 3
  • 11
0
votes
1 answer

Predictable random sequences depending on related seeds

I've had this idea in my head for quite a while, but I failed to articulate it in a searchable way, so I thought I'd ask it as a question. There is a lot of information about seeds and RNG algorithms, but I couldn't find much information about the…
Eric
  • 522
  • 5
  • 9
0
votes
0 answers

Generated 2D terrain with fixed seed across platforms

I'm using a 1D Perlin Noise to generate a 2D terrain for my game. I'm currently looking for the best method to generate terrain with a fixed seed that should look always the same across different platforms/hardware. Currently I'm using Mersenne…