-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi, I am using .NET to create an artificial life program and I am using C#'s pseudo random class defined in a Singleton. The idea is that if I use the same random number generator throughout the application, I could merely save the seed and then reload from the seed to recompute a certain interesting…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The challenge
The shortest code by character count that will generate (pseudo)random numbers using the Middle-Square Method.
The Middle-Square Method of (pseudo)random number generation was first suggested by John Von Neumann in 1946 and is defined as follows:
Rn+1 = mid((Rn)2, m)
For example:
…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have a random number generator:
int32_t ksp_random_table[GENERATOR_DEG] = {
-1726662223, 379960547, 1735697613, 1040273694, 1313901226, 1627687941,
-179304937, -2073333483, 1780058412, -1989503057, -615974602, 344556628,
939512070, -1249116260, 1507946756, -812545463, 154635395,…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I am looking for a random number generator that can be biased. For instance, say I want a random number between 1-5, with the probability being:
1: Comes up 20% of the time
2: Comes up 10% of the time
3: Comes up 40% of the time
4: Comes up 25% of the time
5: Comes up 5% of the time
Is there anything…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Why do i need to create an instance of Random class, if i want to create a random number between 1 and 100 ....like
Random rand = new Random();
rand.Next(1,100);
Is there any static function of Random class to do the same? like...
Random.Next(1,100);
I don't want to create an instance unnecessaril…
>>> More