예제 #1
0
        public ulong Next()
        {
            uint[] current = currentRange;
            int    i;

            for (i = currentRange.Length - 1; i >= 0; i--)
            {
                currentRange[i]++;

                if (currentRange[i] < charCount)
                {
                    break;
                }
                else
                {
                    currentRange[i] = 0;

                    if (i == 0)
                    {
                        uint[] newRange = new uint[currentRange.Length + 1];
                        newRange[0] = 0;

                        int j = 1;
                        foreach (uint cr in currentRange)
                        {
                            newRange[j++] = cr;
                        }

                        currentRange = newRange;
                    }
                }
            }

            return(DecrypterRange.GetNumber(currentRange));
        }
예제 #2
0
        public void InitBlocks(DecrypterRange range)
        {
            this.range = range;
            ulong length = range.GetNumber();

            blocks.Clear();
            BlockSize = length / Convert.ToUInt64(1000 * range.endRange.Length);

            for (ulong plus = 0, id = 0; plus <= length; plus += BlockSize, id++)
            {
                blocks.Add(new ProcessBlock(id, BlockState.Free));
            }

            Random rnd = new Random();

            blocks = blocks.OrderBy(item => rnd.Next()).ToList <ProcessBlock>();

            Initialized = true;
        }
예제 #3
0
 public ulong GetCurrentNumber()
 {
     return(DecrypterRange.GetNumber(currentRange));
 }
예제 #4
0
 public ulong GetNumber()
 {
     return(DecrypterRange.GetNumber(endRange));
 }
예제 #5
0
        public void InitBlocks(DecrypterRange range)
        {
            this.range = range;
            ulong length = range.GetNumber();

            blocks.Clear();
            BlockSize = length / Convert.ToUInt64(1000 * range.endRange.Length);

            for (ulong plus = 0, id = 0; plus <= length; plus += BlockSize, id++)
                blocks.Add(new ProcessBlock(id, BlockState.Free));

            Random rnd = new Random();
            blocks = blocks.OrderBy(item => rnd.Next()).ToList<ProcessBlock>();

            Initialized = true;
        }