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 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. |
… | |
… | |
77 | x = x * A + B; |
77 | x = x * A + B; |
78 | return x; |
78 | return x; |
79 | } |
79 | } |
80 | }; |
80 | }; |
81 | |
81 | |
82 | typedef lc_rng<3039177861U, 0U> borosh_niederreiter_rng; |
82 | typedef lc_rng<3039177861U, 0U> borosh_niederreiter_rng; |
83 | typedef lc_rng<2147001325U, 715136305U> bcpl_rng; |
83 | typedef lc_rng<2147001325U, 715136305U> bcpl_rng; |
84 | typedef lc_rng< 1664525U, 1U> lavaux_janssens_rng; |
84 | typedef lc_rng< 1664525U, 1U> lavaux_janssens_rng; |
|
|
85 | typedef lc_rng< 1664525U, 1013904223U> numerical_recipes_rng; |
85 | |
86 | |
86 | template<typename T, int N, int k> |
87 | template<typename T, int N, int k> |
87 | struct gfsr_rng |
88 | struct gfsr_rng |
88 | { |
89 | { |
89 | int i; |
90 | int i; |
… | |
… | |
137 | // and likely of higher quality. |
138 | // and likely of higher quality. |
138 | typedef gfsr_rng<uint32_t, 250, 103> r250_rng; |
139 | typedef gfsr_rng<uint32_t, 250, 103> r250_rng; |
139 | typedef gfsr_rng<uint32_t, 521, 168> r521_rng; |
140 | typedef 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) |
143 | typedef gfsr_rng<uint32_t, 55, 24> freeciv_rng; |
144 | typedef 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 |
146 | struct r250521_rng |
147 | struct r250521_rng |
147 | { |
148 | { |