public void nextGeneration()
	{
		List<LightningSegment> newSegments = new ArrayList<LightningSegment>();

		int size = segments.size();
		for (int i = 0; i < size; i++)
		{
			LightningSegment lightningSegment = segments.get(i);

			if (getGeneration() == GameController.MAX_LIGHTNING_GENERATIONS)
			{
				segments.remove(i);
				size--;

				if (segments.isEmpty())
				{
					return;
				}
				continue;
			}

			Coordinates mid = lightningSegment.getMidCoordsWithOffset(getRandomOffset(offsetX),
				getRandomOffset(offsetY));
			Coordinates start = lightningSegment.getStart();
			Coordinates end = lightningSegment.getEnd();
			LightningSegment startToMid = new LightningSegment(start, mid, lightningSegment.isTrunk());
			LightningSegment MidToEnd = new LightningSegment(mid, end, lightningSegment.isTrunk());

			newSegments.add(startToMid);
			newSegments.add(MidToEnd);

			if (size == 1)
			{
				double angle = getRandomAngle();
				LightningSegment forkEndSeg = getFork(angle, mid, start, end);
				newSegments.add(forkEndSeg);
			}
			else if (size / 2 <= i)
			{
				if (random.nextInt(100) > 50)
				{
					double angle = getRandomAngle();
					LightningSegment forkEndSeg = getFork(angle, mid, start, end);
					newSegments.add(forkEndSeg);
				}
			}
			generation++;

		}

		if (offsetX != 0)
		{
			offsetX /= 2;
		}
		if (offsetY != 0)
		{
			offsetY /= 2;
		}
		segments = newSegments;
	}