Add script helpers for randomness (+other changes)