Code:
XS(XS__ChooseRandom);
XS(XS__ChooseRandom)
{
dXSARGS;
if (items < 1)
Perl_croak(aTHX_ "Usage: ChooseRandom(... list ...)");
int random = MakeRandomInt(0, items * 10);
int index = random % items;
SV *tmp = ST(0);
ST(0) = ST(index);
ST(index) = tmp;
XSRETURN(1); //return 1 element from the stack (ST(0))
}
instead of what it is... selecting from a larger pool gives "better" "random" results...