It seems that there doesn't exist a state saver in perl. I searched CPAN for random, but nothing with a state saving function. If there does exist such a thing in gnu libs, I would suggest you just make an XS interface to it.