Convert a character string into a random seed
This function creates a seed for the random number generator from a character string. Character strings can be based on student names so that every student has a different random sample, but the teacher can generate the same datasets.
A character string
Logical, should the seed be set or just returned
Additional parameters passed on to
Simulations or other situations call for the need to have repeatable random numbers, it is easier to remember a word or string than a number, so this function converts words or character strings to an integer and optionally sets the seed based on this.
Teachers can assign students to generate a random dataset using their name to seed the rng, this way each student will have a different dataset, but the teacher can generate the same set of data to check values.
Any characters other than letters (a-zA-Z) or digits (0-9) will be silently removed. This function is not case sensitive, so "ABC" and "abc" will generate the same seed.
This is a many to one function, so it is possible to find different words that generate the same seed, but this is unlikely by chance alone.
This returns an integer (but mode numeric) to use as a seed for the
set is true then it is returned invisibly.
Greg Snow firstname.lastname@example.org
1 2 3 4 5 6 7 8
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.