Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to generate vector of random numbers in any interval (e.g. [-1 1]) that sums to 1)
Date: Tue, 9 Nov 2010 12:56:06 +0000 (UTC)
Organization: Stockholm University
Lines: 5
Message-ID: <ibbgd5$b8a$1@fred.mathworks.com>
References: <ibbfkv$l6m$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1289307366 11530 172.30.248.38 (9 Nov 2010 12:56:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Nov 2010 12:56:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2494925
Xref: news.mathworks.com comp.soft-sys.matlab:685091

Just renormalise:

y = rand(1,N);   
S = sum(y);     
y = y/S;           % renormalisation