public void cycle(){
	for (int i = 0; i < n; ++i){
		int t = zid[i];
		-- TinD[t][did[i]];
		-- VinT[vid[i]][t];
		-- Zct[t];
		double[] Prob = new double[z];
		for (int top = 0; top < z; ++top){
			Prob[top] = (( (VinT[vid[i]][top] + .05) * (TinD[top][did[i]] + 1) ) / (double) (Zct[top] + d));
		}
		Multinomial distribution = new Multinomial(Prob);
		t = distribution.sample();
		zid[i] = t;
		++ TinD[t][did[i]];
		++ VinT[vid[i]][t];
		++ Zct[t];
	}
	int[][] topicTimes = new int[z][timespan];
	for (int t = 0; t < z; ++t) {
		Arrays.fill(topicTimes[t], 0);
	}
	for (int i = 0; i < n; ++i){
		int startPt = timestamp[i] - 5;
		int endPt = timestamp[i] + 5;
		if (startPt < minTime) {
			startPt = minTime;
		}
		if (endPt > maxTime) {
			endPt = maxTime;
		}
		startPt -= minTime;
		endPt -= minTime;
		for (int j = startPt; j < endPt + 1; ++j) {
			++topicTimes[zid[i]][j];
		}
	}
	for (int t = 0; t < z; ++ t) {
		for (int year = 0; year < timespan; ++year) {
			timeDist[t][year] = Math.log((((topicTimes[t][year] + 10) / ( (double) Zct[t] + 10)) * 100) + 5);
		}
	}
}