• Great post. Good example of use of random numbers.

    Rand versus NewID has been discussed. Rand only runs once per query, NewID is like other functions, but requires conversion and is not proven to have good distributions and seems a bit slow.

    An alternative is to union a bunch of "select Rand()" statments to create the list of unique random values.

    Select top 10 from

    (

    select cast(rand()*100000 as int) as rnd union

    select cast(rand()*100000 as int) as rnd union

    ...

    select cast(rand()*100000 as int) as rnd union

    select cast(rand()*100000 as int) as rnd

    ) as t

    Union All if you want non-unique numbers

    it may be a long sql query, but its very fast

    BTW if the multiple can easily be a count(*) from some other table, instead of a constant.