That depends on _how_ you want the (pseudo-)random numbers to be distributed
within the range. If you want uniform (i.e., all numbers within the range
equally likely to be sampled), use something like runif(1000, 1, 41). If
you want the discrete (i.e., only integers) version, use sample(1:41, 1000,
replace=T).
Andy
> From: Shuxia Yu
>
> Dear all,
>
> Would someone here like to point me how to generate a series
> random number in a given range, e.g., 1 to 41? rnorm can't
> give what I wanted ...
>
> Thank you very much in advance!
>
> Best wishes,
> Jinsong
>
> --------------------------------------------------------------
> -----------------------
> 周杰伦在"第一现场"与你面对面
> http://smspop.163.com/special/jay200408/index2.html-----------
---------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity named
on this message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and then delete
it from your system.
------------------------------------------------------------------------------
|