Getting previous index values of a python list items after shuffling
<p>Let's say I have such a python list:</p>

<pre><code>l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
</code></pre>

<p>by using <code>random.shuffle</code>, </p>

<pre><code>&gt;&gt;&gt; import random
&gt;&gt;&gt; random.shuffle(l)
&gt;&gt;&gt; l
[5, 3, 2, 0, 8, 7, 9, 6, 4, 1]
</code></pre>

<p>I am having the above list.</p>

<p>How can I get the previous index values list of each item in the shuffled list? </p>

<p>A more intuitive alternative to the other answers:</p>

<p>Shuffle a range of indices, and use that to get a shuffled list of the original values.</p>

python