blob: 1cfec32231216661bfc70c5be62bef29325eb162 [file] [log] [blame]
Benny Prijono9033e312005-11-21 02:08:39 +00001/* $Id$ */
2/*
Benny Prijonoa771a512007-02-19 01:13:53 +00003 * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org>
Benny Prijono9033e312005-11-21 02:08:39 +00004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_RAND_H__
20#define __PJ_RAND_H__
21
22/**
23 * @file rand.h
24 * @brief Random Number Generator.
25 */
26
27#include <pj/config.h>
28
29PJ_BEGIN_DECL
30
31
32/**
33 * @defgroup PJ_RAND Random Number Generator
34 * @ingroup PJ_MISC
35 * @{
36 * This module contains functions for generating random numbers.
37 * This abstraction is needed not only because not all platforms have
38 * \a rand() and \a srand(), but also on some platforms \a rand()
39 * only has 16-bit randomness, which is not good enough.
40 */
41
42/**
43 * Put in seed to random number generator.
44 *
45 * @param seed Seed value.
46 */
47PJ_DECL(void) pj_srand(unsigned int seed);
48
49
50/**
51 * Generate random integer with 32bit randomness.
52 *
53 * @return a random integer.
54 */
55PJ_DECL(int) pj_rand(void);
56
57
58/** @} */
59
60
61PJ_END_DECL
62
63
64#endif /* __PJ_RAND_H__ */
65