fix random generation environment usage

closes PR 14484