Fix style and simplify simulation of graph parameters in R

Fixes to clarify/simplify R code. In particular, use built-in function
sample().