/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int already(int v, int *a, int n)
{
   int i;
   for(i=0;i<n;i++)
   {
      if(v==a[i]) return 1;
   }
   return 0;
}

int main()
{
   int i,a[10];
   srand(time(NULL));
   for(i=0;i<10;i++)
   {
      do
      {
         a[i] = rand() % 10 + 1;
      }
      while(already(a[i],a,i));
   }
   for(i=0;i<10;i++)
   {
      printf("%d\n",a[i]);
   }
   return 0;
}
