in reply to Re^2: how to use conditional loops when using while loop
in thread how to use conditional loops when using while loop

Yeh I have been fighting with the 48/64 bit issue, I added a couple of Fs to pad the hex out to 64 bytes but I am still having problems that I guess are to do with endianisms.

I must admit that is the reason I did not post code yet and now I have to run to the airport. Perhaps I'll get a chance to play later.

The rand issue is solved by rand*rand or similar, I guess the requirement is not for crypto quality randomness here.

Must fly, Cheers,
R.

Pereant, qui ante nos nostra dixerunt!
  • Comment on Re^3: how to use conditional loops when using while loop

Replies are listed 'Best First'.
Re^4: how to use conditional loops when using while loop
by ikegami (Patriarch) on Jul 28, 2005 at 16:51 UTC

    A node I wrote much earlier show how to convert a MAC address from a hex string into a floating point number, since they have more bits of precision. Just be sure not to use integer operations on the number. If you can figure out how to do a large random, here's a harness:

    # IMPORTANT: # $first_mac, $last_mac, $range and $random # are floating point number potentially too # big to fit into an integer. Do not perform # integer operations on them. my $first_mac = mac_hex2num('00:96:14:00:00:00'); my $last_mac = mac_hex2num('00:96:14:2F:FF:FF'); my $range = $last_mac - $first_mac + 1; my $random = ???; my $mac = man_num2hex($first_mac + $random);