Skip to content

Instantly share code, notes, and snippets.

@sudipto80
Created January 4, 2016 09:11
Show Gist options
  • Save sudipto80/c08142d76aa189ded030 to your computer and use it in GitHub Desktop.
Save sudipto80/c08142d76aa189ded030 to your computer and use it in GitHub Desktop.
Algorithm P
//Algorithm P
int[] nums = { 1, 3, 54, 67, 123, 234, 3546, 21, 3, 45 };
for (int i = 0; i < nums.Length; i++)
{
int x = new Random().Next(i, nums.Length - 1);
int y = nums[x];
nums[x] = nums[i];
nums[i] = y;
}
nums.Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment