Changeset 553daf in git for factory/cf_random.cc
- Timestamp:
- Jul 1, 1997, 2:35:11 PM (27 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- b05571db0515adc91bc85368f8dcce880183a651
- Parents:
- eb27afd664afaf2b0a54a0a8e2538973d26c20db
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_random.cc
reb27af r553daf 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: cf_random.cc,v 1. 3 1997-06-19 12:24:01 schmidt Exp $ */2 /* $Id: cf_random.cc,v 1.4 1997-07-01 12:35:11 schmidt Exp $ */ 3 3 4 4 #include <config.h> … … 16 16 class RandomGenerator { 17 17 private: 18 #ifdef macintosh 19 // mac does not like const long int in a class 20 long int ia, im, iq, ir, deflt; 21 #else 18 22 const long int 19 23 ia = 16807, … … 22 26 ir = 2836, 23 27 deflt = 123459876; 28 #endif 24 29 25 30 long s; … … 28 33 void seedInit( long ss ) { s = ((ss == 0) ? deflt : ss); } 29 34 public: 35 #ifdef macintosh 36 RandomGenerator(); 37 RandomGenerator( long ss ); 38 #else 30 39 RandomGenerator() { seedInit( (long)time( 0 ) ); } 31 40 RandomGenerator( long ss ) { seedInit( ss ); } 41 #endif 32 42 ~RandomGenerator() {} 33 43 long generate(); 34 44 void seed( long ss ) { seedInit( ss ); } 35 45 }; 46 47 #ifdef macintosh 48 RandomGenerator::RandomGenerator() 49 { 50 ia = 16807; 51 im = 2147483647; 52 iq = 127773; 53 ir = 2836; 54 deflt = 123459876; 55 seedInit( (long)time( 0 ) ); 56 } 57 58 RandomGenerator::RandomGenerator( long ss ) 59 { 60 ia = 16807; 61 im = 2147483647; 62 iq = 127773; 63 ir = 2836; 64 deflt = 123459876; 65 seedInit( ss ); 66 } 67 #endif 36 68 37 69 long
Note: See TracChangeset
for help on using the changeset viewer.