# Randomly selecting elements without repetition

I assigned energy values to each element in the array as per the program of Verbeia. The program looks like this

Xarray = A @@@ Tuples[Range[0, 1], 3];

energies =
RandomVariate[ExponentialDistribution[1.5], {Length@Xarray}];

f = {#, First@Pick[energies, Xarray, #]} &;

f@Xarray[[5]]


Now I want to randomly select let say 5 elements from this 1000 element array such that no element should repeat. Let { 89,5,79,34,900} be the set of elements I've randomly selected. Now for each element I should get the energies and coordinates automatically. Could anyone do this?

-
as per which program by verbeia? Have you looked at RandomSample? Also, what have you tried doing? – R. M. Jul 5 '12 at 13:49
@R.M, the one on his previous question, apparently... – J. M. Jul 5 '12 at 13:53
Also, it's good form if you actually accept the answer that has helped you. So far you've asked 3 questions, accepted none and upvoted none. Time to read another faq I'm afraid: mathematica.stackexchange.com/faq#howtoask – Ajasja Jul 5 '12 at 14:24
Thank you Ajasja. I actually don't know to how to accept an answer. – Daniel Jul 5 '12 at 14:54

f /@ RandomSample[Xarray, 5]

{{A[1, 1, 0], 0.666428},
{A[1, 0, 0], 1.26861},
{A[0, 0, 0], 0.643917},
{A[0, 1, 0], 0.114058},
{A[0, 0, 1], 0.200398}}

-
sigh... just when I try to teach a man to fish :/ – R. M. Jul 5 '12 at 14:01
If you light a man a fire you keep him warm for a day. If you light a man on fire you keep him warm for the rest of his life. – Mr.Wizard Jul 5 '12 at 14:04
lol 10987654321 – R. M. Jul 5 '12 at 14:06
Thank you Mr.Wizard – Daniel Jul 5 '12 at 14:50