The randomizr package for R (and apparently Stata) provides some nice simple functions to help automate the process of randomly assigning participants to groups in for instance randomised controlled trials.

Common designs include simple random assignment, complete randomization, block randomization, cluster randomization, and blocked cluster randomization. randomizr automates all of these processes and assists scientists in doing transparent, replicable science.