Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources]

Mike D. Schiffman

نسخه متنی -صفحه : 135/ 37
نمايش فراداده

Psuedo-Random Number Functions

These functions implement the libnet pseudo-random number interface.


int libnet_seed_prand(libnet_t *1);

libnet_seed_prand() seeds libnet's pseudo-random number generator with a call to gettimeofday(), which provides more entropy than time(). Upon success, the function returns 1; upon failure, the function returns -1 and libnet_geterror() tells you that gettimeofday() failed.


u_long libnet_get_prand(int type);

libnet_get_prand() returns a positive pseudo-random number within the range specified in type, as summarized in Table 3.55.

Table 3.55: libnet_get_prand() type Symbolic Constants

CONSTANT

MEANING


LIBNET_PR2

0-1


LIBNET_PR8

0-255


LIBNET_PR16

0 - 32767


LIBNET_PRu16

0 - 65535


LIBNET_PR32

0 - 2147483647


LIBNET_PRu32

0 - 4294967295