December 30, 2008 at 6:36 am
I found that generating random numbers is a task best done in code. Generating random numbers in SQL betrays a pattern, which makes repetitive executions predictable.
December 30, 2008 at 8:48 am
Jeff Moden (12/29/2008)
The cast to VarBinary takes more time, Michael. That's the way I used to do it before Peter Larson and Matt Miller showed me this other way.
I actually had more concerns about how random the distribution of numbers would be in this case, since the largest possible integer is only 2,147 times 999,999, while the largest 7 byte BIGINT is 4,503,604,130 times larger than 999,999.
I donโt think it would be easy to test the randomness of the distribution without running massive Monte Carlo simulations to see if there was any pattern.
December 30, 2008 at 6:29 pm
Yeah... you're right on both counts... not enough coffee here... ๐
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply