VuoInteger implementation.
Definition in file VuoInteger.c.
Go to the source code of this file.
Functions | |
VuoInteger | VuoInteger_makeFromJson (json_object *js) |
Decodes the JSON object js to create a new value. More... | |
json_object * | VuoInteger_getJson (const VuoInteger value) |
Encodes value as a JSON object. More... | |
char * | VuoInteger_getSummary (const VuoInteger value) |
Always shows the full value, since it's guaranteed to be pretty short. More... | |
VuoInteger | VuoInteger_minList (VuoList_VuoInteger values, VuoInteger *outputPosition) |
Returns the minimum of a list of terms, or 0 if the array is empty. More... | |
VuoInteger | VuoInteger_maxList (VuoList_VuoInteger values, VuoInteger *outputPosition) |
Returns the maximum of a list of terms, or 0 if the array is empty. More... | |
VuoInteger | VuoInteger_average (VuoList_VuoInteger values) |
Returns the average of the values in the list, or 0 if the list is empty. More... | |
VuoInteger | VuoInteger_wrap (VuoInteger value, VuoInteger minimum, VuoInteger maximum) |
Returns value if it is within the range of minimum to maximum (inclusive), otherwise a value wrapped with modular arithmetic to be within the range. More... | |
static u_int32_t | VuoInteger_arc4random_uniform (u_int32_t upper_bound) |
Calculate a uniformly distributed random number less than upper_bound avoiding "modulo bias". More... | |
VuoInteger | VuoInteger_random (const VuoInteger minimum, const VuoInteger maximum) |
Returns a pseudorandom value between minimum and maximum , inclusive. More... | |
void | VuoInteger_setRandomState (unsigned short state[3], const VuoInteger seed) |
Initializes state using the lower 48 bits of seed . More... | |
VuoInteger | VuoInteger_randomWithState (unsigned short state[3], const VuoInteger minimum, const VuoInteger maximum) |
Returns a pseudorandom value between minimum and maximum , inclusive. More... | |
VuoInteger | VuoInteger_makeFromHexByte (unsigned char byte) |
If byte is a valid ASCII hex character (0–9, a–f, A–F), returns the equivalent numeric value. More... | |
bool | VuoInteger_areEqual (const VuoInteger value1, const VuoInteger value2) |
Returns true if the two values are equal. More... | |
bool | VuoInteger_areEqualListWithinTolerance (VuoList_VuoInteger values, VuoInteger tolerance) |
Returns true if the two values are equal within tolerance . More... | |
bool | VuoInteger_isLessThan (const VuoInteger a, const VuoInteger b) |
Returns true if a < b. More... | |
bool | VuoInteger_isWithinRange (VuoInteger value, VuoInteger minimum, VuoInteger maximum) |
Returns true if value is between minimum and maximum . More... | |
Variables | |
static const char | VuoInteger_hexToDec [256] |
Convert between hex and decimal. More... | |
|
static |
Calculate a uniformly distributed random number less than upper_bound avoiding "modulo bias".
Uniformity is achieved by generating new random numbers until the one returned is outside the range [0, 2**32 % upper_bound). This guarantees the selected random number will be inside [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound) after reduction modulo upper_bound.
Copyright (c) 1999,2000,2004 Damien Miller djm@m.nosp@m.indr.nosp@m.ot.or.nosp@m.g
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Definition at line 194 of file VuoInteger.c.
|
static |
Convert between hex and decimal.
Definition at line 294 of file VuoInteger.c.