Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate numbers with a normal distribution in SQL Server

I'm trying to seed some data, is there anyway to generate numbers in SQL Server that follow a normal distribution curve?

Like: I will specify the mean, the standard deviation and the count and I get a list of numbers back?

like image 253
Mel Avatar asked May 16 '12 03:05

Mel


1 Answers

random normal distribution

UPDATE TABLE 
SET COLUMN = CAST(SQRT(-2*LOG(RAND()))*SIN(2*PI()*RAND(CHECKSUM(NEWID())))as decimal(5,3))    
from TABLE
like image 117
AaronConnell Avatar answered Oct 13 '22 08:10

AaronConnell