C Snippets

Generate random double

static inline double rand_d(double min, double max) {
    return (rand() / (double)INT_MAX) * (max - min) - min;
}