tcod_sys/libtcod/src/mersenne_c.c
double TCOD_random_get_gaussian_double_range_custom (TCOD_random_t mersenne, double min, double max, double mean) {
	double d1, d2, std_deviation, ret;
	if (min > max) {
		double tmp = max;
		max = min;
		min = tmp;
	}
	d1 = max - mean;
	d2 = mean - min;
	std_deviation = MAX(d1,d2) / 3.0;
	ret = TCOD_random_get_gaussian_double(mersenne, mean, std_deviation);
	return CLAMP(min,max,ret);
}
/* Box-Muller, ranges with a custom mean */
Box-Muller, ranges with a custom mean
Box - Muller ranges with a custom mean
double TCOD_random_get_gaussian_double_range_custom (TCOD_random_t mersenne, double min, double max, double mean) {
	double d1, d2, std_deviation, ret;
	if (min > max) {
		double tmp = max;
		max = min;
		min = tmp;
	}
	d1 = max - mean;
	d2 = mean - min;
	std_deviation = MAX(d1,d2) / 3.0;
	ret = TCOD_random_get_gaussian_double(mersenne, mean, std_deviation);
	return CLAMP(min,max,ret);
}
double TCOD_random_get_gaussian_double_range_custom ( TCOD_random_t mersenne , double min , double max , double mean ) { double d1 , d2 , std_deviation , ret ; if ( min > max ) { double tmp = max ; max = min ; min = tmp ; } d1 = max - mean ; d2 = mean - min ; std_deviation = MAX ( d1 , d2 ) / 3.0 ; ret = TCOD_random_get_gaussian_double ( mersenne , mean , std_deviation ) ; return CLAMP ( min , max , ret ) ; }
Box-Muller, ranges with a custom mean
Box - Muller ranges with a custom mean