2015-09-03 10:19:07 +08:00
|
|
|
-- continuous uniform distribution has kurtosis = -6/5, skewness = 0.0
|
|
|
|
-- http://mathworld.wolfram.com/UniformDistribution.html
|
|
|
|
|
|
|
|
With dist As (
|
2015-09-03 10:35:03 +08:00
|
|
|
SELECT random()::numeric As val
|
2015-09-03 10:19:07 +08:00
|
|
|
FROM generate_series(1,5000000) t
|
2015-09-03 10:35:03 +08:00
|
|
|
)
|
2015-09-03 10:19:07 +08:00
|
|
|
|
|
|
|
SELECT
|
2015-09-03 10:35:03 +08:00
|
|
|
-- does random dist values match within 1% of known values
|
|
|
|
abs(CDB_Kurtosis(array_agg(val)) + 1.20) < 1e-2 As kurtosis,
|
|
|
|
abs(CDB_Skewness(array_agg(val)) - 0) < 1e-2 As skewness
|
|
|
|
FROM dist
|