random number->random integer
2
0
Entering edit mode
@denrique-escobar-espinoza-1303
Last seen 10.2 years ago
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
• 763 views
ADD COMMENT
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 10.2 years ago
"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
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 3 months ago
United States
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
ADD COMMENT

Login before adding your answer.

Traffic: 524 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6