I was trying to generate a random-return stored procedure.
Tried so many different ways, and then found a "Clean way" to do what I need..
But.. I am running some simulations, and the numbers of results in 0 and 1 is much less than other values.. What is not fair with this numbers...
This is my code:
DECLARE @val FLOAT
SET @val = (SELECT ROUND(RAND(CHECKSUM(NEWID())), 1))
INSERT INTO randomtable (value)
SELECT @val
GO 1000000
These are the results:
As you can see, there's only 8800 results in 0 and 1 and the others have more than 17000 results..
How can I reliably create a system to generate random values?