Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / isc / include / isc / random.h
blob82ba366eebe3ec5d780f215172ca9f368407543f
1 /*
2 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: random.h,v 1.18.128.2 2009/01/19 23:47:03 tbox Exp $ */
20 #ifndef ISC_RANDOM_H
21 #define ISC_RANDOM_H 1
23 #include <isc/lang.h>
24 #include <isc/types.h>
26 /*! \file isc/random.h
27 * \brief Implements a random state pool which will let the caller return a
28 * series of possibly non-reproducible random values.
30 * Note that the
31 * strength of these numbers is not all that high, and should not be
32 * used in cryptography functions. It is useful for jittering values
33 * a bit here and there, such as timeouts, etc.
36 ISC_LANG_BEGINDECLS
38 void
39 isc_random_seed(isc_uint32_t seed);
40 /*%<
41 * Set the initial seed of the random state.
44 void
45 isc_random_get(isc_uint32_t *val);
46 /*%<
47 * Get a random value.
49 * Requires:
50 * val != NULL.
53 isc_uint32_t
54 isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter);
55 /*%<
56 * Get a random value between (max - jitter) and (max).
57 * This is useful for jittering timer values.
60 ISC_LANG_ENDDECLS
62 #endif /* ISC_RANDOM_H */