[R] Choosing a random number between x and y

Rowe, Brian Lee Yung (Portfolio Analytics) B_Rowe at ml.com
Mon Feb 9 20:14:03 CET 2009


How about this:

> runif(1,0,0.5)
[1] 0.4806179

> runif(1,0,0.7)
[1] 0.1789742


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Vie
Sent: Monday, February 09, 2009 9:41 AM
To: r-help at r-project.org
Subject: [R] Choosing a random number between x and y



Hi,

Ive been trying to find a function that will allow me to pull out a
number
between a minimum and maximum threshold.

I want a random decimal number between, for example, 0 and 0.5 or 0 and
0.7.
I've been searching everywhere for a function that will allow me to do
this
in R, but I have yet to be successful. Any help would be much
appreciated.

Thanks in advance


-- 
View this message in context:
http://www.nabble.com/Choosing-a-random-number-between-x-and-y-tp2191410
6p21914106.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. References to "Merrill Lynch" are references to any company in the Merrill Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this E-communication may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------------------------




More information about the R-help mailing list