user2966197 user2966197 - 3 months ago 40
C++ Question

erand48(X) not working in C++ , Visual Studio 12

I have C++ code which has a line with

erand48(X)
in few lines and Visual Studio gives
Unable to identify
error on this. I searched online and found out that
erand48()
does not exist in Visual Studio (or in Windows). Suggestions were to write the implementation by oneself. Can anyone provide me the implementation for this as I am new to this and I am short at time to give too much of time to this.

Also there are few line which starts with
uniform
like
uniform sampler2D Texture
and it gives error as
the value or constructor 'uniform' not defined
. Why is it showing this error and how to remove this?

Answer

Use uniform_real_distribution Class as instead.

#include <random>
#include <iostream>
std:: default_random_engine generator;
std::uniform_real_distribution<double> distr(0.0,1.0);
double erand48(int X){
    return distr(generator);
}

int main(){
    std::cout << erand48(1) << std::endl;
    return 0;
}

or just use LibGW32C for windows

Comments