Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!c9g2000yqm.googlegroups.com!not-for-mail
From: arun <aragorn168b@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Generating Random numbers
Date: Thu, 2 Jul 2009 04:53:08 -0700 (PDT)
Organization: http://groups.google.com
Lines: 24
Message-ID: <30e9d47f-da31-4386-9584-ba8aec164b30@c9g2000yqm.googlegroups.com>
References: <d639c2c7-c672-4177-b89b-5c584755dabc@x5g2000yqk.googlegroups.com>
NNTP-Posting-Host: 192.124.26.250
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1246535589 9756 127.0.0.1 (2 Jul 2009 11:53:09 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 2 Jul 2009 11:53:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: c9g2000yqm.googlegroups.com; posting-host=192.124.26.250; 
	posting-account=fyqXpgoAAABqt-0BifyaNxmZhzggFACu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) 
	Gecko/20090624 Firefox/3.5,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:552341


On Jul 2, 1:24 pm, Deivy <deiv...@gmail.com> wrote:
> Hi Group,
> I would like to generate a set of numbers between 500 and 600 so that
> the total of them would be 3000.
> How many numbers to generate is unknown but the generated numbers
> should be within the range of 500 to 600 they should total to 3000.
> How do I do this in matlab.
> Could someone help me with this.
>
> A small script that accomplishes this task is highly appreciated.
>
> Thank you,
> Regards,
> Deivy

3000 = 500 * 6 = 600 * 5.

so, the numbers you generate should be able to accomplish the task of
getting a sum of 3000 in 5 or 6 random numbers, otherwise the sum
would exceed 3000. so, its either 5 or 6. and they are not random, I
suppose.. unless the sum is >= 3000 but not == 3000.

best,
arun.