random-number-generator

If the n-body problem is chaotic, why isn't it used as a RNG?

I'm probably missing something pretty basic here, but if the n-body problem yields chaotic results (except in specific highly-symmetric conditions), couldn't it be used as a "true" random number generator (with initial pseudo-random seeds for masses and velocities) given its non-deterministic nature? ...

Did I implement clock drift properly?

I couldn't find any clock drift RNG code for Windows anywhere so I attempted to implement it myself. I haven't run the numbers through ent or DIEHARD yet, and I'm just wondering if this is even remotely correct... void QueryRDTSC(__int64* tick) { __asm { xor eax, eax cpuid rdtsc mov edi, dword ptr tick mov dword ptr [edi], ea...

Generate Random Number from fix Set of numbers in iphone

Suppose I have One set of numbers i.e {1, 6, 3, 5, 7, 9} I want to Generate Random number from this set of number only i.e. a Generated number should be random and should be from these number({1, 6, 3, 5, 7, 9}) only. standard C/C++ function will also do... ...

Generate n-dimensional random numbers in Python

I'm trying to generate random numbers from a gaussian distribution. Python has the very useful random.gauss() method, but this is only a one-dimensional random variable. How could I programmatically generate random numbers from this distribution in n-dimensions? For example, in two dimensions, the return value of this method is essentia...

Help for creating a random String

I need to create a random string which should be between the length of 6 to 10 but it sometimes generates only about the length of 3 to 5. Here's my code. Can anyone would be able to find out the problem? :( int lengthOfName = (int)(Math.random() * 4) + 6; String name = ""; /* randomly choosing a name*/ ...

Latest stream cipher considered reasonably secure & easy to implement?

(A)RC4 used to fit the bill, since it was so simple to write. But it's also less-than-secure these days. I'm wondering if there's a successor that's: Code is small enough to write & debug within an hour or so, using pseudo code as a template. Still considered secure, as of 2010. Optimized for software. Not encumbered by licensing iss...

rng random number

Hi, I have a question. How can I calculate/estimate upper bound of random number, that a random number can generate ? Thanks in advance! ...

Five unique, random numbers from a subset

I know similar questions come up a lot and there's probably no definitive answer, but I want to generate five unique random numbers from a subset of numbers that is potentially infinite (maybe 0-20, or 0-1,000,000). The only catch is that I don't want to have to run while loops or fill an array. My current method is to simply generate ...

Sample uniformly at random from an n-dimensional unit simplex.

Sampling uniformly at random from an n-dimensional unit simplex is the fancy way to say that you want n random numbers such that they are all non-negative, they sum to one, and every possible vector of n non-negative numbers that sum to one are equally likely. In the n=2 case you want to sample uniformly from the segment of the line ...

Probability Random Number Generator

Let's say I'm writing a simple luck game - each player presses Enter and the game assign him a random number between 1-6. Just like a cube. At the end of the game, the player with the highest number wins. Now, let's say I'm a cheater. I want to write the game so player #1 (which will be me) has a probability of 90% to get six, and 2% to...

is there a such thing as a randomly accessible pseudo-random number generator? (preferably open-source)

first off, is there a such thing as a random access random number generator, where you could not only sequentially generate random numbers as we're all used to, assuming rand100() always generates a value from 0-100: for (int i=0;i<5;i++) print rand100() output: 14 75 36 22 67 but also randomly access any random value like: rand...

How do i generate random data with RSA?

After loading my RSACryptoServiceProvider rsa object i would like to create a key for my AES object. Since i dont need to store the AES key (i only need it to decrypt on my prv side) i figure i dont need to store it and i can generate it with my public key. I thought doing rsa.Encrypt(byte[] with 4 hardcoded bytes); would generate the d...

What's the correct way to expand a [0,1] interval to [a,b]?

Many random-number generators return floating numbers between 0 and 1. What's the best and correct way to get integers between a and b? ...

random number generator monkey test diehard

Hi, I have a question about Diehard Testtool. My Random Number Generator doesn't passed monkey test (DNA Test). One p-value was 0. Is this critical? How can I interpret the result? Thank you in advance! ...

Cheap and cheerful rand() replacement.

After profiling a large game playing program, I have found that the library function rand() is consuming a considerable fraction of the total processing time. My requirements for the random number generator are not very onerous - its not important that it pass a great battery of statistical tests of pure randomness. I just want something...

How hard is it to create a not-so-random number generator?

Backstory: So I was driving to band practice this evening. My car has a USB port where you can plug in a USB stick with MP3 files on it and the stereo will play them. I have about 100 MP3s on my stick so I pushed the 'Random' button. So from here to band practice, it played: Track 22 Track 45 Track 4 Track 11 Track 87 Track 66 Track 9...

Generating random numbers in C

While searching for Tutorials on generating random numbers in C I found This Topic When I try to use the rand() function with parameters, I always get the random number generated 0. When I try to use the rand() function with parameters, I always get the value 41. And whenever I try to use arc4random() and random() functions, I get a LN...

Generate Random Numbers with Probabilistic Distribution

Ok, so here's my problem. We are looking at purchasing a data set from a company to augment our existing data set. For the purposes of this question, let's say that this data set ranks places with an organic number (meaning that the number assigned to one place has no bearing on the number assigned to another). The technical range is ...

Random number with modulus in Objective C

I have a very basic random number function which generates a random number from a range; ie: // The random is seeded earlier on in the applicationDidFinishLaunching() function -(NSUInteger)makeRandomNumber:(NSUInteger)minNumber to:(NSUInteger)maxNumber { //NSUInteger i = (NSUInteger)( (random() / (double)RAND_MAX) * y); NSUInteger i...

can we write that function in c form

When I read some question to write random nuber generator ,I saw that function and it efficient but it is written in C#. I want see that function in form of c language,can anyone help? IEnumerable<int> ForLargeQuantityAndRange(int quantity, int range) { for (int n = 0; n < quantity; n++) { int r = Random(range); ...