ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/rng.h
(Generate patch)

Comparing deliantra/server/include/rng.h (file contents):
Revision 1.9 by root, Tue Jan 3 11:25:32 2012 UTC vs.
Revision 1.12 by root, Mon Oct 29 23:55:54 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 5 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 6 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 7 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version. 9 * option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the Affero GNU General Public License 16 * You should have received a copy of the Affero GNU General Public License
17 * and the GNU General Public License along with this program. If not, see 17 * and the GNU General Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>. 18 * <http://www.gnu.org/licenses/>.
19 * 19 *
20 * The authors can be reached via e-mail to <support@deliantra.net> 20 * The authors can be reached via e-mail to <support@deliantra.net>
21 */ 21 */
22 22
23#ifndef RNG_H__ 23#ifndef RNG_H__
24#define RNG_H__ 24#define RNG_H__
77 x = x * A + B; 77 x = x * A + B;
78 return x; 78 return x;
79 } 79 }
80}; 80};
81 81
82typedef lc_rng<3039177861U, 0U> borosh_niederreiter_rng; 82typedef lc_rng<3039177861U, 0U> borosh_niederreiter_rng;
83typedef lc_rng<2147001325U, 715136305U> bcpl_rng; 83typedef lc_rng<2147001325U, 715136305U> bcpl_rng;
84typedef lc_rng< 1664525U, 1U> lavaux_janssens_rng; 84typedef lc_rng< 1664525U, 1U> lavaux_janssens_rng;
85typedef lc_rng< 1664525U, 1013904223U> numerical_recipes_rng;
85 86
86template<typename T, int N, int k> 87template<typename T, int N, int k>
87struct gfsr_rng 88struct gfsr_rng
88{ 89{
89 int i; 90 int i;
137// and likely of higher quality. 138// and likely of higher quality.
138typedef gfsr_rng<uint32_t, 250, 103> r250_rng; 139typedef gfsr_rng<uint32_t, 250, 103> r250_rng;
139typedef gfsr_rng<uint32_t, 521, 168> r521_rng; 140typedef gfsr_rng<uint32_t, 521, 168> r521_rng;
140 141
141// freeciv uses this one, so it's good enough for us :) 142// freeciv uses this one, so it's good enough for us :)
142// (also known as mitchell moore generator 143// (also known as mitchell moore generator)
143typedef gfsr_rng<uint32_t, 55, 24> freeciv_rng; 144typedef gfsr_rng<uint32_t, 55, 24> freeciv_rng;
144 145
145// this one should be high quality, but is slightly slower than tausworthe 146// this one should be high quality, but is slightly slower than tausworthe
146struct r250521_rng 147struct r250521_rng
147{ 148{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines