/*! \brief Initialize the generator \param func The repartition function \param min The minimum value \param max The maximum value \param step The step */ public void init(repartitionFunc func, float min, float max, float step = 0.1f) { _min = min; _step = step; _tab = new float[(int)((max - min) / step) + 3]; _sizeTab = (int)((max - min) / step) + 3; float last = 0f; float i = min; int j = 0; while (i < max) { _tab[j] = func(i, 0f, 0.3f) + last; last = _tab[j]; j++; i += step; } _localMax = last; }
/*! * \brief Initialize the generator * \param func The repartition function * \param min The minimum value * \param max The maximum value * \param step The step */ public void init(repartitionFunc func, float min, float max, float step = 0.1f) { _min = min; _step = step; _tab = new float[(int)((max - min) / step) + 3]; _sizeTab = (int)((max - min) / step) + 3; float last = 0f; float i = min; int j = 0; while (i < max) { _tab[j] = func(i, 0f, 0.3f) + last; last = _tab[j]; j++; i += step; } _localMax = last; }
public void init(repartitionFunc func, float min, float max, float step = 0.1f) { _func = func; _max = max; _min = min; _step = step; _tab = new float[(int)((max - min) / step) + 2]; _sizeTab = (int)((max - min) / step) + 2; float last = 0f; float i = min; int j = 0; while (i < max) { _tab[j] = func(i, 0f, 1f) + last; // Debug.Log(_tab[j]); last = _tab[j]; j++; i += step; } _localMax = last; // Debug.Log(j + " != " + _sizeTab + " i = " + i); // _tab[j] = last; }
public NumberGenerator(repartitionFunc func, float min, float max, float step = 0.1f) { init(func, min, max, step); }
//! Constructor public NumberGenerator(repartitionFunc func, float min, float max, float step = 0.1f) { init(func, min, max, step); }