So
I have a method that gets called on every second to add sprites to a scene.
What i want to do is be able to control the percentage rate of which sprite gets added when the method is called.
So i tried using
Math.Random() > .3;
Basically this would be a 30% chance that the sprite would get added...correct?
So the problem with this was that i only have four sprites. So sometimes when the method was called no sprites would be added to the scene, when each time the method is called a sprite is added.
So tried using
Random rand = new Random();
int itemNumber = rand.nextInt(4) + 1;
if (itemNumber == 1) {
The problem with this is this is totally controlled by the Random generator. When i want to be able to control the percentage of which sprite is added more or less.
So what would be my way of doing this??