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:
230.241.131.133 85.43.133.14 120.13.10.254 204.89.31.1 25.69.101.33 44.1.66.198 129.221.210.21 99.202.149.38 24.181.91.188 17.149.61.201
Copyright © Ben Bullock 2009-2022. 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