QUOTE(PsychoCoder @ 10 Apr, 2008 - 04:21 AM)

Why don't you start by telling us the exact error message(s) you're receiving
Hi,
Thanks for listening to me. Actually, i'm not getting any error messages. The code i've taken in my program for random numbers is
CODE
private void init_genrand(uint s)
{
mt[0] = s & 0xffffffffU;
for (mti = 1; mti < Ng; mti++)
{
mt[mti] =
(uint)(1812433253U * (mt[mti - 1] ^ (mt[mti - 1] >> 30)) + mti);
// In the previous versions, MSBs of the seed affect
// only MSBs of the array mt[].
mt[mti] &= 0xffffffffU;
// for >32 bit machines
}
}
public uint genrand_int32()
{
uint y;
int Ng = 624;
int mti = Ng + 1;
int M = 397;
uint UPPER_MASK = 0x80000000U; // most significant w-r bits
uint LOWER_MASK = 0x7fffffffU; // least significant r bits
uint MATRIX_A = 0x9908b0dfU; // constant vector a
// mag01[x] = x * MATRIX_A for x=0,1
uint[] mag01 = {0x0U, MATRIX_A};
// the array for the state vector
uint[] mt = new uint[Ng];*/
uint y;
if (mti >= Ng)
{ /* generate N words at one time */
int kk;
if (mti == Ng + 1) /* if init_genrand() has not been called, */
init_genrand(5489U); /* a default initial seed is used */
for (kk = 0; kk < Ng - M; kk++)
{
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + M] ^ (y >> 1) ^ mag01[y & 0x1U];
}
for (; kk < Ng - 1; kk++)
{
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + (M - Ng)] ^ (y >> 1) ^ mag01[y & 0x1U];
}
y = (mt[Ng - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
mt[Ng - 1] = mt[M - 1] ^ (y >> 1) ^ mag01[y & 0x1U];
mti = 0;
}
y = mt[mti++];
// Tempering
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680U;
y ^= (y << 15) & 0xefc60000U;
y ^= (y >> 18);
return y;
}
public void activatePackSource(ulong parameter1)
{
double random_number1 = (((double)genrand_int32()) + 0.5) * (1.0 / 4294967296.0);
if (random_number1 <= DefineConstants.p)
{
numPacketsGenerated++;
packetGenerated = 1;
}
My problem is, i want to get a random number between 0.0 to 1.0, by using different seed values. And the Random class supported NextDouble() method is not permitting me to give different seed values, which is very crucial for the program output... for obtaining the accurate result. I'll be very greatful to your new ideas.
Thanking you,
Awaiting your worthy response,
Anil