Please help me to build Lambda expression for below C# for loop , Because the below for loop getting high CPU..
for (int i = 1; i <= dQuantity; )
{
double dlRnd = rnFirst.NextDouble();//with seed
if (dlRnd < 0.0001)
dlRnd += 0.012;
//string strRndFirstDgt = dlRnd.ToString().Substring(2, iFirstPinLng);
long strRndFirstDgt = ExtractDigits(dlRnd, 2, iFirstPinLng);
//----Second Rnd ------ 0.6 91979 52919 26617
double dlSecondRnd = rnSecond.NextDouble(); //Without Seed. 58535 03461 123
if (dlSecondRnd < 0.0001)
dlSecondRnd += 0.012;
long strRndSecondLastsixDgt = ExtractDigits(dlSecondRnd, dlSecondRnd.ToString().Length - iSecondPinLng, iSecondPinLng);
//string strRndSecondLastsixDgt1 = dlSecondRnd.ToString().Substring(dlSecondRnd.ToString().Length - iSecondPinLng, iSecondPinLng);
long conCan = Convert.ToInt64(strRndFirstDgt.ToString() + Convert.ToString(strRndSecondLastsixDgt));
long temp;
temp = Convert.ToInt64(conCan) + DateTime.Now.Ticks; //addition to pin+ datetime Ticks
int intRndThird = rnThird.Next(1, 10);//To avoid the prefix value 0's;
// string conCanRnd = intRndThird.ToString() + Convert.ToString(ExtractDigits(temp,temp.ToString().Length - pinLength, pinLength - 1));
long conCanRnd = Convert.ToInt64(stInt.ToString() + intRndThird.ToString() + (temp.ToString().Substring(temp.ToString().Length - pinLength, pinLength - 1)));
// long sessionconcatpins = Convert.ToInt64(stInt.ToString() + conCanRnd); // Append Concurent User Hit Count in to PINS
if (lstpins.Add(conCanRnd))
i++;
if (i % 100 == 0)
{
lngDateTicker = DateTime.Now.Ticks;
strSeedLastNineDgt = lngDateTicker.ToString().Substring(7, 9);
rnFirst = new Random(Convert.ToInt32(strSeedLastNineDgt));
}
}