cas_rand | R Documentation |
Make random CAS RNs of valid length format, without checksum consideration
cas_rand(n)
n |
integer. How many random CAS RNs do you wish to generate? |
Generate n random CAS RNs with valid CAS digit length (per section and overall). Random applies to
all three sections of a CAS RN; for the first section, lengths will also be of random length, between 2:7
.
This function does not perform any additional validation, which means duplicate CAS are possible. More importantly, there is no last (checksum) digit validation.
A vector of random CAS RNs of length n.
This is mainly useful as a testing tool for cas_checkSum
. See examples.
set.seed(1) random_CASRN <- cas_rand(1E4L) length(unique(random_CASRN)) table(nchar(random_CASRN)-2) #-2 for two dashes #using cas_detect and cas_checkSum table(cas_detect(unique(random_CASRN))) table(cas_checkSum(unique(random_CASRN)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.