s-news
[Top] [All Lists]

Re: Question about random number generation in a user

To: "Overstreet, Jason (FL51)" <Jason.Overstreet@honeywell.com>, s-news@lists.biostat.wustl.edu
Subject: Re: Question about random number generation in a user
From: "Gregory Snow" <Greg.Snow@intermountainmail.org>
Date: Thu, 22 Dec 2005 14:14:37 -0700
Thread-index: AcYHJ6081d+96alxQtq/tTRB9vQ0xQAFOyQA
Thread-topic: [S] Question about random number generation in a user defined function
you could try:
 
output <- sapply(1:100, function(i) ET1() )
 
while technically there is an internal loop, you don't have to write it.
 
Hope this helps,
 

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111

 


From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Overstreet, Jason (FL51)
Sent: Thursday, December 22, 2005 11:39 AM
To: s-news@lists.biostat.wustl.edu
Subject: [S] Question about random number generation in a user defined function

If you run this function you will randomly have an output of 0, 1, 2, 3, or 4. 

What I would like to know how to do is to:
1)Have this function run 100 times (really 10,000) independently
2) the output of each interation assigned as elements in an array. 

I am thinking that some sort of a loop is mandatory in this situation. 

Any pointers?


<<ET1.ssc>>

Jason Overstreet
Statistician
Honeywell DSES
(727) 539-3964


<Prev in Thread] Current Thread [Next in Thread>
  • Re: Question about random number generation in a user, Gregory Snow <=