Hello all,

Here is what I am struggling with:

I have a cube, whose origin is (0,0,0) and one egde length is e.

I am generating random planes with respect to the equation

z = a*x + b*y + c

In order to generate planes, I randomly generate a, b and c first.

After that, I put random points on the planes I have generated.

However, I need my points to be in the cube.

But when I generate my planes randomly, most of the times, z coordinate is huge.

For instance: If my cube is (100 x 100 x 100) and

If I generate x coordinate as 9, then only way for my point to be inside the cube is (9,0,100).

I don't want this for two reasons:

1. The points are distributed so apart, as in example (I generated 10 different planes and those are three random points on three of them)

z = 11x + 9y + 5 42(3.00,0.00,38.00)

z = 13x + 3y + 2 43(2.00,8.00,52.00)

z = 11x + 9y + 5 44(6.00,3.00,98.00)

2. Some of my points are outside of the cube

Please suggest an algorithm for me to generate proper planes and random points on those planes.