#1. SELECT abs(CAST(CRYPT_GEN_RANDOM(4) AS INT)) #2. CREATE FUNCTION dbo.MyRAND(@Seed as bigint) RETURNS float(53) AS BEGIN --Sample: SELECT dbo.MyRAND(DEFAULT), dbo.MyRAND(DEFAULT), dbo.MyRAND(12345) FROM ( SELECT 1 AS ID UNION SELECT 2 UNION SELECT 3 ) as ThreeRows DECLARE @Return as float(53) IF @Seed = 0 SET @Return = (Cast(CRYPT_GEN_RANDOM(8) as bigint) + POWER(Cast(2 as float(53)), 63)) / ..