#include #include using namespace std; double cdf_genrand() { double tmp; tmp = drand48(); if (tmp < 0.4) return (tmp * 1.5); if (tmp < 0.8) return (tmp - 0.4) / 2.0 + 0.6; return tmp; } main() { int i; double tmp; for (i = 0; i < 1000; i++) { cout << cdf_genrand() << endl; } }