Hi
I want to generate a random integer from 1 to 654,
is there any function that can provide a random real between 0&1
[0,1]
that I can multiply by 654 and perform the ceiling() or floor() to
get an integer from that?
Thanks
"D.Enrique ESCOBAR ESPINOZA" <escobarebio at="" yahoo.com=""> writes:
> Hi
> I want to generate a random integer from 1 to 654,
> is there any function that can provide a random real between 0&1
> [0,1]
> that I can multiply by 654 and perform the ceiling() or floor() to
> get an integer from that?
This is more of an R-help question.
If you want a random integer between 1 and 654:
sample(1:654, 1)
You may also be interested in runif()
+ seth
D.Enrique ESCOBAR ESPINOZA wrote:
> Hi
> I want to generate a random integer from 1 to 654,
> is there any function that can provide a random real between 0&1
> [0,1]
> that I can multiply by 654 and perform the ceiling() or floor() to
> get an integer from that?
>
runif()
Sean