Fetch n random integers between 1 and 1,000,000,000
Arguments
- n
how many numbers to generate
- max.digits
maximum number of digits in each number
- seed
set seed for sampling to maintain reproducibility
Examples
number(1)
#> [1] 907976821
number(10)
#> [1] 502720149 872590541 670574391 779360613 716516929 251082113 853062714
#> [8] 723600580 430314937 918284990
paste0(number(2),LETTERS)
#> [1] "755118784A" "385702848B" "755118784C" "385702848D" "755118784E"
#> [6] "385702848F" "755118784G" "385702848H" "755118784I" "385702848J"
#> [11] "755118784K" "385702848L" "755118784M" "385702848N" "755118784O"
#> [16] "385702848P" "755118784Q" "385702848R" "755118784S" "385702848T"
#> [21] "755118784U" "385702848V" "755118784W" "385702848X" "755118784Y"
#> [26] "385702848Z"
#set maximum number of digits
number(1,max.digits = 5)
#> [1] 54108
number(10,max.digits = 4)
#> [1] 9861 6534 8744 1938 3164 1264 8296 5068 7632 6527
#set seed for reproducibility
#without seed
number(6) #result 1
#> [1] 679111020 372809840 927261792 773137178 689163780 188824143
number(6) #result 2, different from result 1
#> [1] 635562510 106427254 115727692 849345678 237283507 685110465
#with seed
number(6,seed=1)#result 3
#> [1] 66608964 312928385 866248189 836151595 554504146 884616499
number(6,seed=1)#result 4, same as result 3
#> [1] 66608964 312928385 866248189 836151595 554504146 884616499