-
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
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Does anybody know where to find solutions for the exercises in the book The Algorithm Design Manual?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Before I start I should add I am a musician and not a native programmer, this was undertook to make my life easier.
Here is the situation, at work I'm given a new csv file each which contains a list of sound files, their length, and the minimum total amount of time they must be played.
I create…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
My code has a list called INPUTS, that contains a dynamic number of lists, let's call them A, B, C, .. N. These lists contain a dynamic number of Events
I would like to call a function with each combination of Events. To illustrate with an example:
INPUTS: A(0,1,2), B(0,1), C(0,1,2,3)
I need to…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Given a Range of numbers say 1 to 10,000, Input is in random order.
Constraint:
At any point only 1000 numbers can be loaded to memory.
Assumption:
Assuming unique numbers.
I propose the following efficient , "When-Required-sort Algorithm".
We write the numbers into files which are designated…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I have seen many questions on stackoverflow where dynamic programming technique can be used to make a exponential algorithm, a polynomial one. I have seen standard problems on dynamic programming. Is there a website or book that contains practice problems and solutions?
Thanks
Bala
>>> More