Best Username Ever
, viewed 143 times)
import java. util. Random;
public class ExploderFactory
private final Random rng;
private final static double averageLifeSpan = 20;
private final static double lifeSpanDevMult = 5;
private final static double lifeSpanMaxDev = 2.5;
private final static double explodeRate = 0.05;
private long count = 1;
public ExploderFactory( long seed)
rng = new Random( seed);
public Exploder createExploder()
double d = rng. nextGaussian();
d = Math. max(- lifeSpanMaxDev, Math. min( lifeSpanMaxDev, d));
d = averageLifeSpan + d * lifeSpanDevMult;
return new Exploder(( int)( d + 0.5), explodeRate, count++);
public long getCount()
To highlight a line (yellow background), prefix it with '@@'
To indicate that a line should be removed (red background), prefix it with '-'
To indicate that a line should be added (green background), prefix it with '+'
To post multiple snippets, seperate them by '~~~~'
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org