00001 /******************************************************************************** 00002 * Neural Network Framework. * 00003 * Copyright (C) 2005-2008 Gianluca Massera <emmegian@yahoo.it> * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ********************************************************************************/ 00019 00020 #ifndef NNFWRANDOM_H 00021 #define NNFWRANDOM_H 00022 00029 #include "types.h" 00030 00031 00032 namespace nnfw { 00033 00038 class NNFW_API Random { 00039 public: 00042 00045 static void setSeed( long int seed ); 00046 00049 static Real flatReal( ); 00050 00053 static Real flatReal( Real min, Real max ); 00054 00057 static RealVec& flatRealVec( RealVec& vec, Real min, Real max ); 00058 00061 static RealMat& flatRealMat( RealMat& mat, Real min, Real max ); 00062 00065 static bool boolean( Real trueProb ); 00066 00069 static bool boolean( ); 00070 00073 static u_int flatInt( u_int x ); 00074 00077 static int flatInt( int x, int y ); 00078 00081 static Real gauss( Real mean, Real stdev ); 00082 }; 00083 00084 } 00085 00086 #endif