Hi guys.
I'm trying to do some opt-3 swapping on my TSP generator for euclidian distances, and since I in many cases have more than ~500 nodes, I need to randomly select at least 1 of the 3 nodes that I want to try swapping.
So basically I need a random-number function that's fast. (the normal rand() is way too slow) It doesn't have to...
i need to print out numbers 1-100 in a random order. the print statement should be:
echo 'h{'.$num.'}';
what is the shortest code to do this?
...
Are there any built-in libraries in Python or Numpy to generate random numbers based on various common distributions, such as:
Normal
Poisson
Exponential
Bernoulli
And various others?
Are there any such libraries with multi-variate distributions?
...
I am writing a procedure where each call it needs to get a single random number. This procedure is called from our .net web service.
I tried implementing this using rand(). However, when I have multiple calls to the stored procedure within milliseconds, I am getting a lot of collisions in that the same random number is being generat...
I am thinking about getting one of these (PCI) to set up an internal entropy pool similar to this service who incidentally brought us fun captcha challenges.
Prior to lightening my wallet, I'm hoping to gather feedback from people who may be using this device. As there is no possible 'correct' answer, I am making this CW and tagging it ...
Hi,
I'm looking for known libraries that are able to generate non uniformly distributed random numbers for C, C++ and Java.
Thanks
...
I need an algorithm that pretty much will turn a unix timestamp into a suitably random number, so that if I "play back" the timestamps I get the same random numbers.
And here's what I mean by suitably:
Most humans will not detect a loop or pattern in the random numbers.
It need not be cryptographically secure.
All numbers must be capa...
According to various sources, such as Wikipedia and various .edu websites found by Google, the most common ways for a hash table to resolve collisions are linear or quadratic probing and chaining. Randomized probing is briefly mentioned but not given much attention. I've implemented a hash table that uses randomized probing to resolve ...
How do random number generator works? (for example in C/C++ Java)
How can I write my own random number generator? (for example in C/C++ Java)
...
Here is a fun one: I need to generate random x/y pairs that are correlated at a given value of Pearson product moment correlation coefficient, or Pearson r. You can imagine this as two arrays, array X and array Y, where the values of array X and array Y must be re-generated, re-ordered or transformed until they are correlated with each...
I know this kind of question has been asked a few times, but alot of them answers boil down to RTFM, but I'm hoping if I can ask the right question... I can get a quasi-definitive answer for everyone else as well, regarding implementation.
I'm trying to generate a sequence of random numbers in one of the two following ways:
#include <c...
Hey, I've just started learning JavaScript and I'm making a little script that generates two numbers, the first number stays the same but the second number gets regenerated if it doesn't match the first number.
Here is my script:
function randomNumberMatcher(){
$(document).ready(function(){
var number1 = Math.floor(1000000*Mat...
Hello! I'm trying to generate a random 160bit string which is supposed to be stored in a character array named str[20]. It's obvious that the array holds 20 characters. How can I change the 160bits into 20 characters/numbers? I'm trying to do this in C.. Any help is greatly appreciated as I've ran out of ideas and then helpdesk at my uni...
i have the following code inside a static method in a static class
Random r = new Random();
int randomNumber = r.Next(1,100);
i have this inside a loop and i keep getting the same randomNumber?
any suggestions here?
...
I am using a C# implementation of Mersenne Twister I downloaded from CenterSpace. I have two problems with it:
No matter how I seed the algorithm it does not pass DieHard tests, and by that I mean I get quite a lot of 1s and 0s for p-value. Also my KStest on 269 p-values is 0. Well, I cannot quite interpret p-value, but I think a few 1...
How can I make a fast RNG (Random Number Generator) in C# that support filling an array of bytes with a maxValue (and/or a minValue)?
I have found this http://www.codeproject.com/KB/cs/fastrandom.aspx but doesn't have these feature.
...
So here is one of the simplest things one might do:
Random rng = new Random();
int a = rng.nextInt(10);
int b = rng.nextInt(10);
So far so good. But we want to avoid having equal a and b, so naturally we do:
Random rng = new Random();
int a = rng.nextInt(10);
int b = rng.nextInt(10);
while (a == b){
b = rng.nextInt(10);
}
However...
i am using the random number generator provided with stl c++. how do we bias it so that it produces smaller random numbers with a greater probability than larger random numbers.
...
I know I have done this before, but now I'm struggling with it again. I am trying to set a random number on either side of 1: .98, 1.02, .94, 1.1, etc. If I get a random number between 0 and 100, how can I use that to get within the range I want?
The programming language doesn't really matter here. I'm using Pure Data. Just looking ...
Hey guys, this is very likely a total brain fart on my part but I was hoping someone could have a look at the following statement which describes how to set up the lagged fibonacci rng:
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
For 1 ≤ k ≤ 55, s(k...