在模拟投掷硬币的试验中,

rbinom(100,1,0.5)
sample(c(0,1), 100, replace = TRUE,prob=c(0.5,0.5))

这两个命令有什么区别,为什么rbinom要好呢?