factor this out into a function
use a custom op instead of OP_RAND