作者:Truly
这个就是核心
代码
1 private static long GetNext(int seed)
2 {
3 int initSeed = (int)(DateTime.Now.Ticks - seed * 10000);
4 Random ran = new Random(initSeed);
5 double d;
6 long ret;
7
8 do
9 {
10 d = ran.NextDouble();
11 ret = Convert.ToInt64(d * (Math.Pow(10, 15)));
12 }
13 while (ret <= MIN || ret > MAX);
14
15 return ret;
16 }
2 {
3 int initSeed = (int)(DateTime.Now.Ticks - seed * 10000);
4 Random ran = new Random(initSeed);
5 double d;
6 long ret;
7
8 do
9 {
10 d = ran.NextDouble();
11 ret = Convert.ToInt64(d * (Math.Pow(10, 15)));
12 }
13 while (ret <= MIN || ret > MAX);
14
15 return ret;
16 }
然后用这个组合数组,再用折半查找法处理重复的,结果作为seed再随机即得出最终结果,然后使用62进制类转换为8位字符