X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frandom_generator.hpp;h=5e5b3c6513ece2f12c8b3851c23d8105fea016cf;hb=5667d7e94d85f968ab914bc457edd689fc907253;hp=9ffb0a617d7639bf0a71cfed0298b880e9824378;hpb=77d6c22146b06e5737b905795c8d7aab3f146527;p=supertux.git diff --git a/src/random_generator.hpp b/src/random_generator.hpp index 9ffb0a617..5e5b3c651 100644 --- a/src/random_generator.hpp +++ b/src/random_generator.hpp @@ -1,5 +1,5 @@ // $Id$ -// +// // A strong random number generator // // Copyright (C) 2006 Allen King @@ -9,16 +9,16 @@ // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. +// documentation and/or other materials provided with the distribution. // 3. Neither the name of the project nor the names of its contributors // may be used to endorse or promote products derived from this software -// without specific prior written permission. -// +// without specific prior written permission. +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -28,14 +28,12 @@ // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. #ifndef __RANDOM_GENERATOR__ #define __RANDOM_GENERATOR__ -#include "script_interface.hpp" - class RandomGenerator { private: @@ -81,6 +79,8 @@ private: long rand_deg; long rand_sep; long *end_ptr; + int debug; + static const int rand_max = 0x7fffffff; // biggest signed Uint32 public: RandomGenerator(); @@ -95,7 +95,7 @@ public: // generate random 31-bit numbers // calls to the following return a value evenly distributed between u (or - // 0 if not specified) and v (or RAND_MAX if not specified). Return + // 0 if not specified) and v (or rand_max if not specified). Return // values may include u, but never v. int rand(); int rand(int v);