Code example for Random

Methods: nextInt

0
 
	@Override 
	public WorldGenerator getRandomWorldGenForTrees(Random random, World world)
	{        
 
		int rand = random.nextInt(100);
		if(rand < 40) {
			return getTreeGen(treeCommon1,treeCommon1Size);
		} else if(rand < 80) {
			return getTreeGen(treeCommon2,treeCommon2Size);
		} else if(rand < 95) {
			return getTreeGen(treeUncommon,treeUncommonSize);
		} else { 
			return getTreeGen(treeRare,treeRareSize);
		} 
	} 
 
 
	public void SetupTrees(World world, Random R)
	{ 
		treeCommon1 = R.nextInt(13);