Hi Matt,<br><br>For random generation I am using this dirty generatator.<br>Do you think it is ok?<br><br>void RandomGenerator::SetTimeSeed()<br>{<br> srand ( time(NULL) );<br>}<br><br>BigUnsigned RandomGenerator::GeneratePseudoRandomNumber(const BigUnsigned& min, const BigUnsigned& max)<br>
{<br> const int arrayLength = 34;<br> unsigned long array[arrayLength];<br><br> for (int i=0; i <arrayLength; i++ )<br> {<br> unsigned long low = rand();<br> unsigned long high = rand();<br><br>
low &= 0x0000FFFF;<br> high &= 0x0000FFFF;<br> high = high << 16;<br><br> int tam = sizeof(unsigned long);<br> if (tam == 8) // if long is 64 bits instead of 32 as int<br>
{<br> unsigned long upper_low = rand();<br> unsigned long upper_high = rand();<br> upper_low &= 0x0000FFFF;<br> upper_high &= 0x0000FFFF;<br> <br> upper_low = upper_low << 32;<br>
upper_high = upper_high << 48;<br> <br> array[i] |= low;<br> array[i] |= high;<br> array[i] |= upper_low;<br> array[i] |= upper_high;<br> <br>
}<br> else <br> {<br> array[i] = high | low;<br> }<br><br><br> <br> }<br><br> BigUnsigned result(array, arrayLength);<br><br> result = (result % (max-min +1) ) + min;<br>
<br> return result;<br>}<br><br><br>Thanks,<br>Nicolas.<br>