R: random_strings

random_strings {stringfish} | R Documentation

## random_strings

### Description

A function that generates random strings

### Usage

    random_strings(N, string_size = 50, charset = "abcdefghijklmnopqrstuvwxyz",
                          vector_mode = "stringfish")

### Arguments

`N` | The number of strings to generate
`string_size` | The length of the strings
`charset` | The characters used to generate the random strings (default: abcdefghijklmnopqrstuvwxyz)
`vector_mode` | The type of character vector to generate (either stringfish or normal, default: stringfish)

### Details

The function uses the PCRE2 library, which is also used internally by R. Note: the order of paramters is switched compared to the 'gsub' base R function, with subject being first. See also: https://www.pcre.org/current/doc/html/pcre2api.html for more documentation on match syntax.

### Value

A character vector of the random strings

### See Also

gsub

### Examples

    set.seed(1)
    x <- random_strings(1e6, 80, "ACGT", vector_mode = "stringfish")

[Package stringfish version 0.12.1 Index]