1 /*
2 	mersenne.h
3 
4 	Mersenne Twister PRNG
5 
6 	Copyright (C) 2013 Bill Currie <bill@taniwha.org>
7 
8 	Author: Bill Currie <bill@taniwha.org>
9 	Date: 2013/01/21
10 
11 	This program is free software; you can redistribute it and/or
12 	modify it under the terms of the GNU General Public License
13 	as published by the Free Software Foundation; either version 2
14 	of the License, or (at your option) any later version.
15 
16 	This program is distributed in the hope that it will be useful,
17 	but WITHOUT ANY WARRANTY; without even the implied warranty of
18 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 
20 	See the GNU General Public License for more details.
21 
22 	You should have received a copy of the GNU General Public License
23 	along with this program; if not, write to:
24 
25 		Free Software Foundation, Inc.
26 		59 Temple Place - Suite 330
27 		Boston, MA  02111-1307, USA
28 
29 */
30 
31 #ifndef __QF_mersenne_h
32 #define __QF_mersenne_h
33 
34 #include "QF/qtypes.h"
35 
36 #define MT_STATE_SIZE	624
37 typedef struct {
38 	uint32_t    state[MT_STATE_SIZE];
39 	int index;
40 } mtstate_t;
41 
42 
43 void mtwist_seed (mtstate_t *state, uint32_t seed);
44 uint32_t mtwist_rand (mtstate_t *state);
45 
46 #endif//__QF_mersenne_h
47