Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

rand() warmup

Name: Anonymous 2012-01-20 16:28

void init_random() {
    clock_t start = clock();
    int i = 0;
    while (clock() - start == 0) {
        i++;
    }
    srand(time(0) + i);
}


17±3 ms
Is it okay?

Name: Anonymous 2012-01-20 17:20

>>6
I think that I'll stick with
void init_random() {
    long seed;
    srand(time(0) + seed + (long)&seed);
}


I think the scheduling interference on clock() latency is “more” random, but I don't think I'll get much better results.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List