Home | History | Annotate | Download | only in lib

Lines Matching refs:mult

45 	int mult;
54 * min:max[:mult]
56 * any of the values may be blank (ie. min::mult, :max, etc.) and default
62 * which is malloc'd by the routine. The min, max, and mult entries of each
73 * defmult default value to plug in for mult, if missing
75 * can call to parse the min, max, and mult strings. This
135 rp->mult = defmult;
148 * Parse the 'min' field - if it is zero length (:n2[:mult]
185 * Process the 'mult' field - if one was not present
187 * then set the mult field to defmult - otherwise pass then
188 * mult field to the parse function.
192 if ((*parse_func) (multstr, &rp->mult) < 0) {
233 * Three simple functions to return the min, max, and mult values for a given
250 return ((struct range *)rbuf)[r].mult;
254 * random_range(int start, int end, int mult, char **errp)
257 * of 'mult'. Start and end may be any valid integer, but mult must be an
264 * mult < 1
265 * no numbers in the start-end range that are a multiple of 'mult'
271 * Note - if mult is 1 (the most common case), there are error conditions
278 long random_range(int min, int max, int mult, char **errp)
288 if (mult < 1) {
290 sprintf(errbuf, "mult arg must be greater than 0");
302 orig_mult = mult;
318 if ((r = min % mult)) /* bump to the next higher 'mult' multiple */
319 min += mult - r;
321 if ((r = max % mult)) /* reduce to the next lower 'mult' multiple */
324 if (min > max) { /* no 'mult' multiples between min & max */
338 nmults = ((max - min) / mult) + 1;
345 return (long)(min + (((long)lrand48() % nmults) * mult));
353 return (long)(min + ((randnum % nmults) * mult));
357 return (min + ((lrand48() % nmults) * mult));
365 long random_rangel(long min, long max, long mult, char **errp)
375 if (mult < 1) {
377 sprintf(errbuf, "mult arg must be greater than 0");
389 orig_mult = mult;
405 if ((r = min % mult)) /* bump to the next higher 'mult' multiple */
406 min += mult - r;
408 if ((r = max % mult)) /* reduce to the next lower 'mult' multiple */
411 if (min > max) { /* no 'mult' multiples between min & max */
425 nmults = ((max - min) / mult) + 1;
432 return (long)(min + (((long)lrand48() % nmults) * mult));
440 return (long)(min + ((randnum % nmults) * mult));
444 return (min + ((lrand48() % nmults) * mult));
452 long long mult, char **errp)
463 if (mult < 1) {
465 sprintf(errbuf, "mult arg must be greater than 0");
477 orig_mult = mult;
493 if ((r = min % mult)) /* bump to the next higher 'mult' multiple */
494 min += mult - r;
496 if ((r = max % mult)) /* reduce to the next lower 'mult' multiple */
499 if (min > max) { /* no 'mult' multiples between min & max */
513 nmults = ((max - min) / mult) + 1;
520 (((long long)lrand48() % nmults) * mult));
527 return (long long)(min + ((randnum % nmults) * mult));