Blender V2.61 - r43446

btRandom.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/
00003 
00004 This software is provided 'as-is', without any express or implied warranty.
00005 In no event will the authors be held liable for any damages arising from the use of this software.
00006 Permission is granted to anyone to use this software for any purpose, 
00007 including commercial applications, and to alter it and redistribute it freely, 
00008 subject to the following restrictions:
00009 
00010 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00011 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00012 3. This notice may not be removed or altered from any source distribution.
00013 */
00014 
00015 
00016 
00017 #ifndef GEN_RANDOM_H
00018 #define GEN_RANDOM_H
00019 
00020 #ifdef MT19937
00021 
00022 #include <limits.h>
00023 #include <mt19937.h>
00024 
00025 #define GEN_RAND_MAX UINT_MAX
00026 
00027 SIMD_FORCE_INLINE void         GEN_srand(unsigned int seed) { init_genrand(seed); }
00028 SIMD_FORCE_INLINE unsigned int GEN_rand()                   { return genrand_int32(); }
00029 
00030 #else
00031 
00032 #include <stdlib.h>
00033 
00034 #define GEN_RAND_MAX RAND_MAX
00035 
00036 SIMD_FORCE_INLINE void         GEN_srand(unsigned int seed) { srand(seed); } 
00037 SIMD_FORCE_INLINE unsigned int GEN_rand()                   { return rand(); }
00038 
00039 #endif
00040 
00041 #endif
00042