osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/Random

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003 * Copyright 2008-2010 Pelican Mapping
00004 * http://osgearth.org
00005 *
00006 * osgEarth is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU Lesser General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU Lesser General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU Lesser General Public License
00017 * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018 */
00019 #ifndef OSGEARTH_RANDOM_H
00020 #define OSGEARTH_RANDOM_H 1
00021 
00022 #include <osgEarth/Common>
00023 
00024 namespace osgEarth
00025 {
00030     class OSGEARTH_EXPORT Random
00031     {
00032     public:
00033         enum Method
00034         {
00035             METHOD_FAST        // not great, but super-fast and cheap.
00036         };
00037 
00038     public:
00044         Random( Method method =METHOD_FAST );
00045 
00052         Random( unsigned seed, Method method =METHOD_FAST );
00053 
00057         Random( const Random& rhs );
00058 
00062         void reset();
00063 
00068         unsigned next( unsigned mod );
00069 
00073         double next();
00074 
00075     private:
00076         Method   _method;
00077         unsigned _seed;
00078         unsigned _next;
00079     };
00080 }
00081 
00082 #endif // OSGEARTH_RANDOM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines