/** * Generates new random height in given amplitude (generated numbers will range from - amplitude to + amplitude) * @param rMax Limit of result * @return generated height */ static inline height_t RandomHeight(amplitude_t rMax) { amplitude_t ra = (Random() << 16) | (Random() & 0x0000FFFF); height_t rh; /* Spread height into range -rMax..+rMax */ rh = A2H(ra % (2 * rMax + 1) - rMax); return rh; }
/** * Generates new random height in given amplitude (generated numbers will range from - amplitude to + amplitude) * @param rMax Limit of result * @return generated height */ static inline height_t RandomHeight(amplitude_t rMax) { /* Spread height into range -rMax..+rMax */ return A2H(RandomRange(2 * rMax + 1) - rMax); }