Best c++ way to choose randomly position of set bit in bitset
<p>I have <code>std::bitset&lt;32&gt; word</code> and I want to choose randomly and index (0-31) of some bit which is 1. How can I do that without loops and counters. Is there any <code>std::algorithm</code> suitable for that?
If it's easier I can convert the <code>bitset</code> to string or int and make it on the string or int.</p>