2004-12-30 17:48:19 +01:00
|
|
|
#ifndef MATHS_H
|
|
|
|
#define MATHS_H
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
#include <math.h>
|
2004-12-30 17:48:19 +01:00
|
|
|
|
2004-12-23 13:58:39 +01:00
|
|
|
#include "bygfoot.h"
|
|
|
|
|
|
|
|
/**
|
2004-12-30 17:48:19 +01:00
|
|
|
Macros for random number generation (#rnd for float, #rndi and #gauss_disti for integer).
|
2004-12-23 13:58:39 +01:00
|
|
|
*/
|
2005-04-04 12:36:04 +02:00
|
|
|
#define math_rnd(lower,upper) g_rand_double_range(rand_generator, lower, upper)
|
|
|
|
#define math_rndi(lower,upper) g_rand_int_range(rand_generator, lower, upper + 1)
|
2004-12-30 17:48:19 +01:00
|
|
|
#define math_gauss_disti(lower, upper) ((gint)rint( math_gauss_dist((gfloat)lower - 0.499, (gfloat)upper + 0.499)))
|
2004-12-23 13:58:39 +01:00
|
|
|
|
2005-04-04 12:36:04 +02:00
|
|
|
gdouble
|
2004-12-30 17:48:19 +01:00
|
|
|
math_gaussrand(void);
|
2004-12-23 13:58:39 +01:00
|
|
|
|
2005-04-04 12:36:04 +02:00
|
|
|
gdouble
|
|
|
|
math_gauss_dist(gdouble lower, gdouble upper);
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
gint
|
2004-12-30 17:48:19 +01:00
|
|
|
math_get_place(gint value, gint place);
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
gint
|
2004-12-30 17:48:19 +01:00
|
|
|
math_round_integer(gint number, gint places);
|
|
|
|
|
|
|
|
void
|
|
|
|
math_generate_permutation(gint *array, gint start, gint end);
|
2004-12-23 13:58:39 +01:00
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
gint
|
|
|
|
math_get_bye_len(gint number);
|
|
|
|
|
|
|
|
gint
|
2005-03-03 13:46:48 +01:00
|
|
|
math_sum_int_array(const gint *array, gint max);
|
2005-01-09 21:21:22 +01:00
|
|
|
|
2004-12-23 13:58:39 +01:00
|
|
|
#endif
|