Ok, this is a really weird one.
I have an MPI program, where each process has to generate random numbers in a fixed range (the range is read from file). What happens is that even though I seed each process with a different value, and the numbers generated by rand() are different in each process, the expression to generate the random num...
Hello,
I'm looking for a special hash-function. Let's say I have a large list of strings, if I order them by their hash-values they should be ordered quasi randomly.
The most important point is: it must be super fast. I've tried md5 and sha1 and they're using to much cpu power.
Clashes are not a problem.
I'm using javascript, so it ...
What are some alternative methods to generate 1000 distinct random integers in the range [0,8000] as opposed to the following:
naive method: generating a number and checking if it's already in the array. O(n^2)
linear shuffle: generate sequence 0 to 8000, shuffle, take the first 1000. O(n)
...
I want to create a token generator that generates tokens that cannot be guessed by the user and that are still unique (to be used for password resets and confirmation codes).
I often see this code; does it make sense?
md5(uniqid(rand(), true));
According to a comment uniqid($prefix, $moreEntopy = true) yields
first 8 hex chars = ...
Most of us know that the command random.randint(1,n) in Python (2.X.X) would generate a number in random (pseudo-random) between 1 and n. I am interested in knowing what is the upper limit for n ?
...
Given a list of items x1 ... xn and associated probabilties p1 ... pn that sum up to 1 there's a well known procedure to select a random item with its associated proabability by sorting the list according to weight, choosing a random value between 1 and 0, and adding up to a culmination sum until it exceeds the value selected and return ...
What kind of algorithms would generate random "goo balls" like those in World of Goo. I'm using Proccesing, but any generic algorithm would do.
I guess it boils down to how to "randomly" make balls that are kind of round, but not perfectly round, and still looking realistic?
Thanks in advance!
...
Possible Duplicate:
True random number generator
I have worked with random functions in python,ruby, MATLAB, Bash and Java. Nearly every programming language has a function to generate random numbers. However, these apparently random sequences are termed as pseudo-random number sequences as the generation follows a determinis...
This MSDN article proves the correctness of Reservoir Sampling algorithm as follows:
Base case is trivial. For the k+1st
case, the probability a given
element i with position <= k is in R
is s/k.
The probability i is replaced is the probability k+1st element is chosen multiplied by i being chosen to be replaced, which is: s/(k+1) * 1...
In python the function random() generates a random float uniformly in the semi-open range [0.0, 1.0). In principle can it ever generate 0.0 (i.e. zero) and 1.0 (i.e. unity)? What is the scenario in practicality?
...
Before you start marking this as a duplicate, read me out. The other question has a (most likely) incorrect accepted answer.
I do not know how .NET generates its GUIDs, probably only Microsoft does, but there's a high chance it simply calls CoCreateGuid(). That function however is documented to be calling UuidCreate(). And the algorithm...
Does anyone know of one? I need to test some upload/download scripts and need some really large files generated. I was going to integrate the test utility with my debug script.
...
Does Java have any functionality to generate random characters or strings? Or must one simply pick a random integer and convert that integer's ascii code to a character?
...
I know I'm doing this a bad way... but I'm having trouble seeing any alternatives. I have an array of products that I need to select 4 of randomly. $rawUpsellList is an array of all of the possible upsells based off of the items in their cart. Each value is a product object. I know this is horribly ugly code but I don't see an altern...
Hey there,
I know this can't be that hard. I've searched, but I can't seem to find a simple solution. I want to call a method, pass it the length and have it generate a random alphanumeric string.
Any ideas? Are there any utility libraries out there that may have a bunch of these types of functions?
Thanks,
Howie
...
Hello
I want to get N random numbers that the sum of them is a value.
For example, let's suppose I want 5 random numbers that their sum is 1
Then, a valid possibility is:
0.2 0.2 0.2 0.2 0.2
Other possibility is:
0.8 0.1 0.03 0.03 0.04
And so on. I need this for the creation of the matrix of belongings of the Fuzzy C-means.
...
I am trying to generate a good random seed for a psudo-random number generator. I thought I'd get the expert's opinions. let me know if this is a bad way of doing it or if there are much better ways.
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <ctime>
unsigned int good_seed()
{
unsigned int random_seed, ran...
I wrote a program in java that rolls a die and records the total number of times each value 1-6 is rolled. I rolled 6 Million times. Here's the distribution:
#of 0's: 0
#of 1's: 1000068
#of 2's: 999375
#of 3's: 999525
#of 4's: 1001486
#of 5's: 1000059
#of 6's: 999487
(0 wasn't an option.)
Is this distribution consistant with random...
I have a function that outputs items in a different order depending on a random number. for example 1/2 of the time Popeye's and its will be #1 on the list and Taco Bell and its logo will be #2 and half the time \it will be the other way around.
The problem is that when a user reloads or comes back to the page, the order is re-random...
Could somebody explain to me the architecture behind chatroulette?
I was thinking about a similar project that would only implement Audio
support (for starters). Is the best way to set this up a flash server?
If so, how should I go about getting into flash, will I need flex 4? I
have some beginner experience with c++, c# and java but I h...