ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/md_code/randomSPRNG.cpp
Revision: 220
Committed: Mon Dec 30 16:20:42 2002 UTC (21 years, 6 months ago) by chuckv
File size: 593 byte(s)
Log Message:
Added more code to randomSPRNG classes.

File Contents

# User Rev Content
1 chuckv 219 #include <iostream>
2     #include <cmath>
3    
4     #include "randomSPRNG.hpp"
5     #include "simError.h"
6    
7    
8 chuckv 220 /* randomStreamSPRNF creates a new SPRNG stream for random numbers
9     */
10 chuckv 219
11 chuckv 220 int ranStreamSPRNG::nSPRNGStreams;
12 chuckv 219
13 chuckv 220 randomStreamSPRNG::randomStreamSPRNG(){
14     #ifdef IS_MPI
15 chuckv 219
16 chuckv 220
17    
18     #else
19     nSPRNGStreams++;
20    
21     myStreamNumber = nSPRNGStreams;
22    
23     thisStream = init_sprng(GTYPE,streamnum,nstreams,SEED,SPRNG_DEFAULT);
24    
25    
26     #endif
27 chuckv 219 }
28 chuckv 220
29     randomStreamSPRNG::~randomStreamSPRNG(){
30    
31     free_sprng(int *thisStream);
32     nSPRNGStreams--;
33    
34    
35     }
36    
37    
38     double getRanStreamSPRNG(){
39     double ranNum;
40     nanNum = sprng(thisStream);
41     return ranNum;
42     }