Secret Santa Challenge Possible Duplicate:
  Holiday Gift Exchange  




Background:
Secret Santa is a Western Christmas tradition in which members of a group or community are randomly assigned a person to whom they anonymously give a gift.

http://en.wikipedia.org/wiki/Secret_Santa


  


Ok, me and my work colleges did this today during our lunch hour - we made a secret algorithm santa pick random gifters and receivers.

Think of this question as a Christmas Programming Challenge to see who can come up with some of the most elegant solutions for this problem. 

Input:
The input should be an array ['Oliver', 'Paul', 'Rowan', 'Darren', 'Nick', 'Atif', 'Kevin']

Output
A representation of something similar to key value pairs for the gifter and receiver. e.g.

Oliver -&gt; Darren,
Paul -&gt; Nick,
Rowan -&gt; Kevin
Kevin -&gt; Atif,
Darren -&gt; Paul,
Nick -&gt; Oliver,
Atif -&gt; Rowan


Deadline: 15th December (for those late christmas shoppers)

Remember: you cannot have a person choosing themselves and the program must not spiral off into an infinite loop when gifter == receiver when there is only one person left.

Rules:


Must not have duplicates
Must be random (we all have different views on what is random - but you get my gist)
No Language constraints 
Have fun


Here is mine (not golfed) in ruby:

require 'pp'

def move(array, from, to)
  array.insert(to, array.delete_at(from))
end

gifters = ['Oliver', 'Paul', 'Rowan', 'Darren', 'Nick', 'Atif', 'Kevin'].shuffle!
recievers = gifters.dup

move recievers, recievers.count - 1, 0

pp Hash[gifters.zip recievers]


which spits out:

{"Nick"=&gt;"Darren",
 "Paul"=&gt;"Nick",
 "Kevin"=&gt;"Paul",
 "Rowan"=&gt;"Kevin",
 "Atif"=&gt;"Rowan",
 "Oliver"=&gt;"Atif",
 "Darren"=&gt;"Oliver"}
k (29 20 chars)

{i!(1_i),*i:(-#x)?x}



    {i!@[i:(-:#x)?x;,/|2 0N#!#x]}

Example

k){i!(1_i),*i:(-#x)?x}`person1`person2`person3`person4`person5
person2| person1
person5| person3
person4| person2
person1| person5
person3| person4


Explanation - as above, shuffles list and maps to rotation of itself.