Select a random set of rows without any duplicates
<p><strong>How can I display a random set of questions (pulled from Wordpress) without any duplicates?</strong></p>

<p>This is what I've tried:</p>

<pre><code>&lt;?php 
$amount = get_field('select_number_of_questions');
$rand_max = count(get_field('step_by_step_test')) -1;
$rand = rand($amount,$rand_max); 
$i = 0;

while(has_sub_field('step_by_step_test')):
    if($rand == $i):
        echo the_sub_field('question');
    endif;
    $i++;
endwhile;
?&gt;
</code></pre>

<p>At the moment it just shows 1 random question.</p>

<p>It's all dynamic so for instance there can be a total of 10, 20, 31 questions etc. The total amount of questions to select is defined by <code>get_field('select_number_of_questions');</code></p>

<p><code>count(get_field('step_by_step_test')) -1;</code> is getting the total amount of questions to select from.</p>

<p>So in conclusion I want it to select the amount of questions defined by <code>get_field('select_number_of_questions');</code> from a total of <code>count(get_field('step_by_step_test')) -1;</code> without any duplicates.</p>
