Make an interactive version. Drag the seed slider for different arrangements:
Here’s the code to draw 20 transparent spheres in random positions:
Graphics3D[Table[{Opacity[.5], Sphere[RandomReal[5, 3]]}, {20}]]
Use Manipulate to make the number of spheres interactive.
Wrap the expression with Manipulate[...], replace 30 with the variable number and specify that number ranges from 5 to 200 in steps of 1. Drag the slider to change the number of spheres:
Manipulate[
Graphics3D[
Table[{Opacity[.5], Sphere[RandomReal[5, 3]]}, {number}]],
{number, 5, 200, 1}
]
The spheres jump around as you drag the slider because RandomReal gives different coordinate positions each time.
If you add SeedRandom[12345] to the code, the sphere arrangement stays the same as you drag the slider. That’s because SeedRandom resets the random number generator to the same point each time the spheres are drawn, so that you get the same sequence of random numbers:
Manipulate[
SeedRandom[12345];
Graphics3D[
Table[{Opacity[.5], Sphere[RandomReal[5, 3]]}, {number}]],
{number, 5, 200, 1}
]
Let the random number seed vary from 10000 to 50000 in steps of 1 to select different sphere arrangements:
Manipulate[
SeedRandom[seed];
Graphics3D[
Table[{Opacity[.5], Sphere[RandomReal[5, 3]]}, {number}]],
{number, 5, 200, 1},
{seed, 10000, 50000, 1}
]
Add a control to set the opacity. Let the opacity vary from 0 to 1 with an initial value of 1:
Manipulate[
SeedRandom[seed];
Graphics3D[
Table[{Opacity[opacity], Sphere[RandomReal[5, 3]]}, {number}]],
{{opacity, 1}, 0, 1},
{number, 5, 200, 1},
{seed, 10000, 50000, 1}
]
Manipulate[
SeedRandom[seed];
Graphics3D[
Table[{Opacity[opacity], Sphere[RandomReal[5, 3]]}, {number}]],
{{opacity, 1}, 0, 1},
{number, 5, 200, 1},
{seed, 10000, 50000, 1}
]