We cannot write a program that generates randomness, because as soon as we've done so it can be used to predict that randomness. We can extropolate (within limits) randomness, mix it, & adjust its probability distribution. But randomness itself must be sourced as input!
There's dedicated circuits for this, & often we can extract randomness from other inputs as sideeffect of the digitization process.
Maybe randomness is just what we don't understand, or maybe its some sort of nonsentient deity.