Of course you may iterate over all possible IPs, and ping them, but often firewalls drop icmp-echo-requests. No answer isn't guaranteed to mean 'IP unused'.
If your network is the internet (it often is, isn't it?), and you would try to get every IP - what a fun for young people hanging around...