Пример #1
0
TEST(ppm,access_by_complex_and_vector){
  for(int n=0;n<N;++n){
    ppm<uint8_t> p=rand_ppm<uint8_t>();
    for(int i=0;i<1000;++i){
      double
	x=Rand.next_double(-10,p.width()+10),
	y=Rand.next_double(-10,p.height()+10);
      complex<double> z(x,y);
      vector2<double> pt(x,y);
      EXPECT_TRUE(p(x,y)==p(z));
      EXPECT_TRUE(p(x,y)==p(pt));
    }
  }
}
Пример #2
0
double uniform(){
  // unform distribution
  static pfi::math::random::random<mersenne_twister> r;
  return r.next_double(-sqrt(3.0),sqrt(3.0));
}