Add support for randomly selecting an index or element (with internal or external RNG)