random elements and array detection