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.7 by root, Tue Apr 26 14:41:36 2011 UTC vs.
Revision 1.8 by root, Sat Apr 30 11:02:25 2011 UTC

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, 0> 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;
84 85
85template<typename T, int N, int k> 86template<typename T, int N, int k>
86struct gfsr_rng 87struct gfsr_rng
87{ 88{
88 int i; 89 int i;
136// and likely of higher quality. 137// and likely of higher quality.
137typedef gfsr_rng<uint32_t, 250, 103> r250_rng; 138typedef gfsr_rng<uint32_t, 250, 103> r250_rng;
138typedef gfsr_rng<uint32_t, 521, 168> r521_rng; 139typedef gfsr_rng<uint32_t, 521, 168> r521_rng;
139 140
140// freeciv uses this one, so it's good enough for us :) 141// freeciv uses this one, so it's good enough for us :)
142// (also known as mitchell moore generator
141typedef gfsr_rng<uint32_t, 55, 24> freeciv_rng; 143typedef gfsr_rng<uint32_t, 55, 24> freeciv_rng;
142 144
143// this one should be high quality, but is slightly slower than tausworthe 145// this one should be high quality, but is slightly slower than tausworthe
144struct r250521_rng 146struct r250521_rng
145{ 147{
147 r521_rng r521; 149 r521_rng r521;
148 150
149 void seed (uint32_t seed); 151 void seed (uint32_t seed);
150 uint32_t next (); 152 uint32_t next ();
151}; 153};
154
155/////////////////////////////////////////////////////////////////////////////
152 156
153// this is actually an adaptor that provides different 157// this is actually an adaptor that provides different
154// distributions of random numbers. 158// distributions of random numbers.
155template<class generator> 159template<class generator>
156struct random_number_generator : generator 160struct random_number_generator : generator

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines