Make a random IP address in Perl
This Perl script makes reasonably convincing random IPv4 internet addresses.
#!/home/ben/software/install/bin/perl use warnings; use strict; sub randomip { my @digits; for (0..3) { push @digits, int (rand (255) + 1); } return join '.', @digits; } for (0..9) { print randomip (), "\n"; }
The output looks like this:
207.73.168.238 109.174.97.57 167.124.226.104 58.78.223.130 196.58.237.97 153.236.179.19 181.25.191.186 133.100.178.78 84.205.252.175 126.201.146.130
Copyright © Ben Bullock 2009-2023. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com) or use the discussion group at Google Groups.
/
Privacy /
Disclaimer