Random Number Generation with Blitz

Dear all,

I am running blitz 0.9 and g++ (GCC) 3.3.3 (SuSE Linux).

I wrote a test program 'beta.cpp' to generate a random number from the beta distribution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <random/beta.h>

using namespace std;
using namespace ranlib;

int main()
{        
  Beta<double> betaGen;        
  betaGen.setParameters( 1.0, 5.0 );        
  double x = betaGen.random();
  
  cout << x << endl; 

  return 0;
}


When I compile it, I get the following errors:

Beta_test> g++ beta.cpp -I/home1/usr2/psherida/blitz/include -o beta

beta.cpp: In function `int main()':beta.cpp:9: error: no matching function for call to `ranlib::Beta<double, ranlib::defaultIRNG, ranlib::defaultState>::Beta()'/home1/usr2/psherida/blitz/include/random/beta.h:52: error: candidates are: ranlib::Beta<double, ranlib::defaultIRNG, ranlib::defaultState>::Beta(const ranlib::Beta<double, ranlib::defaultIRNG, ranlib::defaultState>&)/home1/usr2/psherida/blitz/include/random/beta.h:57: error: ranlib::Beta<T, IRNG, stateTag>::Beta(T, T) [with T = double, IRNG = ranlib::defaultIRNG, stateTag = ranlib::defaultState

I believe I have followed the instructions in Chapter 9 of the blitz manual precisely. Any suggestions would be much appreciated.

Regards,

Paul Sheridan
Last edited on
Try to replace:
1
2
  Beta<double> betaGen;        
  betaGen.setParameters( 1.0, 5.0 ); 

with:
 
  Beta<double> betaGen( 1.0, 5.0 ); 
Topic archived. No new replies allowed.