The problem is that the output always shows a little or above it. For example, there are 10000 observations. I don't get exact 6000 observations as 0 and 4000 observations as 1.

My code:
set obs 10000
gen a = uniform()
gen b = 0
replace b = 1 if a <= 0.40

What is wrong with this? Or is there any alternative?