Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
Created June 14, 2014 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsrinivas/45c3d343a085018d71fa to your computer and use it in GitHub Desktop.
Save zsrinivas/45c3d343a085018d71fa to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <float.h>
#include <setjmp.h>
#include <signal.h>
int matrix[]={0,1,2,3,4,5,6,7,8};
void seedrand()
{
static int i=1;
if (i)
srand(time(NULL));
i=0;
}
void swap(int *p, int *q)
{
int temp;
temp=*p;
*p=*q;
*q=temp;
}
void shuffle(int *data, int low, int high)
{
int j;
seedrand();
if (low>=high)
return ;
j=rand()%(high-low) + low;
swap(data+low, data+j);
shuffle(data, low+1, j);
shuffle(data, j+1, high);
return ;
}
int main(int argc, char const *argv[])
{
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment