package cn.hnthyy.thmz.Utils;

import java.util.Date;
import java.util.Random;
 
public class SeedUtil {
	private static String key="K";
	private static Long randomNumber;
	private static Long curIndex = Long.valueOf(0L);
 
	public SeedUtil() {
	}
 
	public synchronized static String getId() {
		Long index = null;
		// 从0到999 curIndex*100 curIndex 100-99900
		index = (curIndex = curIndex.longValue() + 1L).longValue() % 1000L;
		if (curIndex.longValue() >= 1000L) {
			curIndex = 0L;
		}
		// 随机数 1-10
		randomNumber = Long.valueOf(new Random().nextInt(100));
		Long temp=(new Date()).getTime() * 10000L + index.longValue() * 100L
				+ randomNumber.longValue();
		return key+temp;
	}


	public static void main(String [] args){
		System.out.println(SeedUtil.getId());
	}
}