What is the recommended/fashionable way to generate a random number in DirXML-Script these days?

I know of several approaches, wondering which is best.

1. EcmaScript - via Math.random
2. Java - <token-xpath expression="java.util.Random:new()"/>
3. Generate-Password against a numeric only password policy?? (not tested, just an idea)

any other ways ? Is the second option still the simplest?