This is unnecessarily complex. All of your work is in the
Agent::random routine, and doesn't depend in any way on the scaffolding that you have established to make an object with attributes. You're not even using an object, let alone attributes!
-- Randal L. Schwartz, Perl hacker