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));
        }
Exemple #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;
        }
 public ulong GetCurrentNumber()
 {
     return(DecrypterRange.GetNumber(currentRange));
 }
 public ulong GetNumber()
 {
     return(DecrypterRange.GetNumber(endRange));
 }
        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;
        }