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:
34.29.63.228 130.83.202.164 53.53.11.122 150.162.44.91 235.82.227.22 7.38.139.212 161.129.55.158 173.94.9.150 212.137.86.37 225.217.178.203
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