Module talk:Random

This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 07:26, 2 December 2013 (Setting random seed: reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 11 years ago by Mr. Stradivarius in topic Setting random seed

Setting random seed

I suggest setting a flag when the random seed is set, so it can be set just once. I know it won't help with multiple invocations of the module, since the flag won't be preserved, but at least when random numbers are being generated multiple times during a given function call, the risk of repeating the same seed value will be eliminated. isaacl (talk) 17:39, 30 November 2013 (UTC)Reply

Actually, sometimes generating the same number is necessary, as some wikicode assumes that {{rand}} generates the same number every time it is called on the same page. (This can now be done with the |same= parameter.) But I think you do have a point - it was messy code to call setRandomSeed so many times. I've reworked the module so that it is only called once. — Mr. Stradivarius ♪ talk ♪ 07:26, 2 December 2013 (UTC)Reply