Moderators: phlip, Larson, Moderators General, Prelates
22/7 wrote:If I could have an alternate horn that would yell "If you use your turn signal, I'll let you in" loud enough to hear inside another car, I would pay nearly any amount of money for it.
headprogrammingczar wrote:I would do a method similar to one-time pad encryption. Take a huge-normous file (i.e. your OS's hibernate file) and compress it, then encrypt it. Then make whatever algorithm you want to do random access lookup on the file. As for multi-variable parametrization, you can use matrix operations to flatten the arguments into an integer. It would be nice to know what it is for, and whatever it happens to be for, come up with a solution yourself before implementing any suggestions here.
int stored_seed = get_stored_seed();
int x, y;
for (y = origin_y; y < viewport_height; y++) {
srand(stored_seed ^ y);
for (x = 0; x < origin_x; x++) {
rand();
}
for (x = origin_x; x < viewport_width; x++) {
plot(x - origin_x, y - origin_y, rand() % TONE_RANGE);
}
}int stored_seed = get_stored_seed();
int x, y;
for (y = origin_y; y < viewport_height; y++) {
for (x = origin_x; x < viewport_width; x++) {
srand(stored_seed ^ x ^ y);
plot(x - origin_x, y - origin_y, rand() % TONE_RANGE);
}
}size_t size;
int * stored_seeds = get_stored_seeds(&size);
rand_buf * state = new_rand(stored_seeds, size);
int coords[2];
for (coords[0] = origin_y; coords[0] < viewport_height; coords[0]++) {
for (coords[1] = origin_x; coords[1] < viewport_width; coords[1]++) {
plot(x - origin_x, y - origin_y, get_rand(state, coords, sizeof(coords)) % TONE_RANGE);
}
}people are like LDL cholesterol for the internet
segmentation fault wrote:poll the sound card. its always generating random white noise.
Berengal wrote:So to rephrase, you want to be able to find the n-th term of a prng without calculating all terms <n?
Unparallelogram wrote:Why not let your (i,j)-th pseudo-random number be hash(seed + i + j) or something, + being concatenation? Cryptographic hashes give very good pseudo-randomness, but of course simpler hashes are cheaper computationally if that matters to you.
petschge wrote:Now if you want to get x_j directly compute x_j = x_0 ^{(2^j mod ((p - 1)*(q-1)))}
Users browsing this forum: Bing [Bot], Google Feedfetcher and 3 guests