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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.