Re: [R] generate random numbers for lotteries

2012-04-29 Thread Mike Miller
On Sun, 29 Apr 2012, Daniel Nordlund wrote: I don't know what the OP is really trying to accomplish yet, and I am not motivated (yet) to try to figure it out. However, all this "flooring" and "ceiling) and "rounding" is not necessary for generating uniform random integers. For N integers in

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Mike Miller > Sent: Sunday, April 29, 2012 5:21 PM > To: Vale Fara > Cc: r-help@r-project.org; billy am > Subject: Re: [R] generate random numbers for lott

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Mike Miller
On Mon, 30 Apr 2012, Vale Fara wrote: ok, what to do is to generate two sets (x,y) of integer uniform random numbers so that the following condition is satisfied: the sum of the numbers obtained in x,y matched two by two (first number obtained in x with first number obtained in y and so on) is

Re: [R] generate random numbers for lotteries

2012-04-29 Thread R. Michael Weylandt
On Sun, Apr 29, 2012 at 4:38 PM, Vale Fara wrote: > Hi, > > thank you both for your replies, I really appreciate it! > > To Mike: yes, random integers. Can I use the function round() as in > the example with 5 random numbers below? > > To Billy: for the second part I got an error, but it may be th

Re: [R] generate random numbers for lotteries

2012-04-29 Thread jim holtman
I would assume that you would use 'sample' to draw the numbers: > sample(0:10,60,TRUE) [1] 2 3 1 2 9 2 2 0 3 [10] 0 4 2 3 9 7 3 10 9 [19] 8 5 8 7 6 3 10 0 6 [28] 8 10 6 3 3 2 7 0 0 [37] 1 4 8 2 10 2 0 7 9 [46] 9 9 7 9 6 10 1 1 6 [55] 1 8 3 8 2

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Vale Fara
Hi, thank you both for your replies, I really appreciate it! To Mike: yes, random integers. Can I use the function round() as in the example with 5 random numbers below? To Billy: for the second part I got an error, but it may be that I didn't properly set "i"...? Here is the R output: x <- runi

Re: [R] generate random numbers for lotteries

2012-04-29 Thread R. Michael Weylandt
On Apr 29, 2012, at 2:25 AM, billy am wrote: > Interesting set of question.. I am completely new to R but let me try my > luck. > > Random number in R > > x <- runif(60 , 0 , 10) # 60 numbers from 0 to 10 > y<- runif(60, 15 , 25) # same as above , from 15 to 25 > > The second part though. D

Re: [R] generate random numbers for lotteries

2012-04-29 Thread billy am
Interesting set of question.. I am completely new to R but let me try my luck. Random number in R x <- runif(60 , 0 , 10) # 60 numbers from 0 to 10 y<- runif(60, 15 , 25) # same as above , from 15 to 25 The second part though. Do you mean , for( i in 1:length(x)) { z = x[i] + y[i] return z }

Re: [R] generate random numbers for lotteries

2012-04-28 Thread Mike Miller
On Fri, 27 Apr 2012, Vale Fara wrote: I am working with lotteries and I need to generate two sets of uniform random numbers. Requirements: 1) each set has 60 random numbers random integers? 2) random numbers in the first set are taken from an interval (0-10), whereas numbers in the second s

[R] generate random numbers for lotteries

2012-04-27 Thread Vale Fara
 Hi, I am working with lotteries and I need to generate two sets of uniform random numbers. Requirements: 1) each set has 60 random numbers 2) random numbers in the first set are taken from an interval (0-10), whereas numbers in the second set are taken from a higher interval (15-25) 3) numbers ge