We start with a variable that holds an integer for the "number of items" that we have somewhere, somehow.
Then, the algorithm is applied: each one of those items have a 70% chance to be destroyed.
If the algorithm was something like
round( num_of_items * 0.7 ), that wouldn't work as expected, for obvious reasons (one would be that
items=1 would always return
0, instead of 70% times
0 and 30% times
I can't afford calculating a chance of 70% one time for each item, because there might be millions.
Is there any algorithm that could do this with a constant cost?