Check if cookies are allowed.
Added a new mechanism for choosing a single element at random.