Jump to content

rand and mt_rand aren't random on win32!


fizix

Recommended Posts

Hi

 

Are the processes running on different servers? How are the processes split up (ie, are they several processes fired off simultaneously).

 

Is there a specific range of ip addresses (presume you are not interested in every IP going)?

 

If you had (say) 256 processes, then each one could have one of one group of IP addresses leaving them each just to store the ints output as a medium int (ie, 3 byte integer, enough to store 3 parts of the ip address). Or doing something similar with 2 of the groups of IP numbers.

 

All the best

 

Keith

IP address is just 4 numbers each from 0 to 255, so just really a 4 byte unsigned integer (or 4 unsigned tinyints).

 

No, an IP address is one 32-bit unsigned integer. The dotted notation is for humans, not computers. So to get a random IP address you just generate a random number lower than 4294967296 and convert it to dotted format.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.