Exemple #1
0
 public void setRandom(Random random)
       /* Sets all the scalars in 'this' to random values uniformly distributed
        *   over (0.0, 1.0) using the pseudo-random generator 'random'. */
     {
   // setZero();
   for (int k = 0; k < size; ++k) f[k] = random.nextFloat();
 }
Exemple #2
0
  public ScalarImage(int width, int height, Random random)
        /* Constructs a new ScalarImage = < width, height, zero-buffer > */
      {
    this.width = width;
    this.height = height;
    size = width * height;

    f = new float[size];
    offset = new int[height];
    for (int j = 0; j < height; ++j) offset[j] = width * j;

    for (int k = 0; k < size; ++k) f[k] = random.nextFloat();
  }