00001 /* $Revision: 1.5 $ $Date: 2006/09/08 18:55:37 $ $Author: dgl $ $Name: $ $Id: Random.cpp,v 1.5 2006/09/08 18:55:37 dgl Exp $ */ 00002 // The Musimat Tutorial © 2006 Gareth Loy 00003 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 00004 // and published exclusively by The MIT Press. 00005 // This program is released WITHOUT ANY WARRANTY; without even the implied 00006 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00007 // For information on usage and redistribution, and for a DISCLAIMER OF ALL 00008 // WARRANTIES, see the file, "LICENSE.txt," in this distribution. 00009 // "Musimathics" is available here: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916 00010 // Gareth Loy's Musimathics website: http://www.musimathics.com/ 00011 // The Musimat website: http://www.musimat.com/ 00012 // This program is released under the terms of the GNU General Public License 00013 // available here: http://www.gnu.org/licenses/gpl.txt 00014 00015 #include <time.h> 00016 #include "Musimat.h" 00017 00018 Static class Random ran; 00019 00020 Integer LCRandom( ) { Return ran.lCRandom( ); } 00021 00022 Real Random( Real L, Real U ) 00023 { 00024 Return ran.random( L, U ); 00025 } 00026 00027 Integer Random( Integer L, Integer U ) 00028 { 00029 Return ran.random( L, U ); 00030 } 00031 00032 Integer IRandom( Integer L, Integer U ) 00033 { 00034 Return ran.random( L, U ); 00035 } 00036 00037 Integer SeedRandom( Integer seed ) 00038 { 00039 Return ran.seed( seed ); 00040 } 00041 00042 Integer Random::getTime( ) 00043 { 00044 Return( Integer(time(0)) ); // time_t 00045 } 00046 00047 Integer Time() 00048 { 00049 Return ran.getTime(); 00050 }