prng

True random number generator

Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article? ...

Do stateless random number generators exist?

Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this? I have a web application that ...

What Type of Random Number Generator is Used in the Gaming Industry?

Given the extremely high requirements for unpredictability to prevent casinos from going bankrupt, what random number generation algorithm and seeding scheme is typically used in devices like slot machines, video poker machines, etc.? EDIT: Related questions: http://stackoverflow.com/questions/203382/do-stateless-random-number-generat...

Pitfalls of cryptographic code

I'm modifying existing security code. The specifications are pretty clear, there is example code, but I'm no cryptographic expert. In fact, the example code has a disclaimer saying, in effect, "Don't use this code verbatim." While auditing the code I'm to modify (which is supposedly feature complete) I ran across this little gem which...

How do I generate random numbers on the iPhone?

What is the best way to generate random numbers using Objective C on the iPhone? If I use (int)((double) rand() / ((double)(RAND_MAX) + (double) 1) * 5.0) to generate a number from 0 to 4, every time I start the program on the iPhone it generates the same numbers to start off with. ...

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 numColours */] } The colours themselves can be chosen / generated randomly, but the method m...

Do PRNG need to be thread safe?

As long as concurrent calls don't cause seg-v's or return the same value, what reasons are there for preventing race conditions and data corruption in PRNGs when those error's primary effects are unpredictable results and that is the point of a PRNG? Edit: are there any PRNG that wouldn't suffer under race conditions and data corrupti...

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 computable normal number, and increments n. My first thought was that perhaps we hadn't found...

Is it possible to generate random numbers through physical process simulation?

Is it possible to generate random numbers through physical process simulation? If I simulate the physical roll of a dice (i.e. you picking it up, shaking it in your hand, releasing it onto the table and recording which side ends up "up"...) will that produce a "random" number or would I just have a complex simulation which really accomp...

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. ...

What is a good hashing algorithm for seeding a prng with a string?

I am looking for a hashing algorithm that produces a 31/32 bit signed/unsigned integer as a digest for a utf8 string with the purpose of using the output for seeding a prng, such as a Park-Miller-Carta LCG or a Mersenne-Twister. I have looked into FNV1 and FNV1a, but they provide very close values for similar strings differing in their ...

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 a period longer than 230. I am currently using a 32 bit Xorshift: #!/usr/bin/perl use s...

Computing (a*b) mod c quickly for c=2^N +-1

In 32 bit integer math, basic math operations of add and multiply are computed implicitly mod 2^32, meaning your results will be the lowest order bits of the add or multiply. If you want to compute the result with a different modulus, you certainly could use any number of BigInt classes in different languages. And for values a,b,c < 2^3...

Does any software exist for building entropy pools from user input?

It'd be nice to be able, for some purposes, to bypass any sort of algorithmically generated random numbers in favor of natural input---say, dice rolls. Cryptographic key generation, for instance, strikes me as a situation where little enough random data is needed, and the requirement that the data be truly random is high enough, that thi...

Random Number Generator in CUDA

Hey people I've struggled with this all day, I am trying to get a random number generator for threads in my CUDA code. I have looked through all forums and yes this topic comes up a fair bit but I've spent hours trying to unravel all sorts of codes to no avail. If anyone knows of a simple method, probably a device kernel that can be c...

Inverse of A*X MOD (2^N)-1

Given a function y = f(A,X): unsigned long F(unsigned long A, unsigned long x) { return ((unsigned long long)A*X)%4294967295; } How would I find the inverse function x = g(A,y) such that x = g(A, f(A,x)) for all values of 'x'? If f() isn't invertible for all values of 'x', what's the closest to an inverse? (F is an obsolete...

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 idea: int get_rand() { srand(time(NULL)); return rand(); } since calling get_rand several ...

Multiple random number generator states in c/Unix

I'm using srandom() and random() to generate random numbers in c on a Unix system. I would like to have multiple RNGs. Each one, given the same seed, should output the same sequence. I would also like to save and restore the state of each one. Here's a pseudocode example: R1 = new_rng(5); //5 is the seed R2 = new rng(5); //5 is the ...

programatically using Hardware Random number generator

I'm working on a desktop application and would love to use any hardware random number generators that happen to be available, though I dont want the user to have to do any confusing setup to use it. its Java/Clojure based so something in the java world would be nice though I'm willing to work with just about anything. Know of any program...

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 use a simplified Fortuna PRNG in this case (encrypting a counter with a randomly chosen u...