Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Random number for triangular distribution
Date: Sat, 29 Sep 2012 06:09:17 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <k463ad$dm5$1@newscl01ah.mathworks.com>
References: <k43g98$ksh$1@newscl01ah.mathworks.com> <k43h3f$njc$1@newscl01ah.mathworks.com> <k43hpv$plh$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1348898957 14021 172.30.248.35 (29 Sep 2012 06:09:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 29 Sep 2012 06:09:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:779523

"Partha Roy" <p_roy_007@yahoo.com> wrote in message <k43hpv$plh$1@newscl01ah.mathworks.com>...
> ..... I want to determine random numbers from a triangular distribution like (5,7,10). 
- - - - - - - - -
  Here's a slightly different method:

 n = 100000;
 a = 5; b = 10; c = 7;
 r = c+sqrt(rand(n,1)).*(a-c+rand(n,1)*(b-a)); 

Roger Stafford