Skip to content

Instantly share code, notes, and snippets.

@tomhopper
Forked from anonymous/random_word_vector.R
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhopper/db218f7f51b982883a26 to your computer and use it in GitHub Desktop.
Save tomhopper/db218f7f51b982883a26 to your computer and use it in GitHub Desktop.
# Create 2 replicates of 5 "words" generated from random characters,
# each "word" 5 - 15 characters long, with word length following a
# poisson distribution.
rep(replicate(5, paste(sample(letters, round(rpois(5000, lambda = 3)+5, 0), replace = FALSE), collapse = "")), 2)
# Sample output:
# [1] "rfexnwyjst" "vwtadhjnly" "ztfgvldo" "tmerol" "mcqhosap" "rfexnwyjst" "vwtadhjnly" "ztfgvldo" "tmerol"
#[10] "mcqhosap"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment