#include <stdio.h>
#include <stdlib.h>
#include "bsp1.h"
#undef NO_PRINT
#define NO_PRINT
#define WRITEX(Y)   for(k=0;k<i-1;k++) { if (compare((char*)&data[d*k],(char*)&data[d*(k+1)])>0) printf("error %s \n",#Y);}

int compare (byte *s1, byte *s2)
{
  return memcmp(s1, s2, SELEM) ;
}
int compare_tn (byte *s1, byte *s2, t_type n)
{
  return memcmp(s1, s2, n) ;
}


int  main(int argc, char **argv) {
  byte          data;
  t_type        n,d,range,offset   ;
  double        t1, t2             ;
  t_type        i,j,k                ;
  double        t3, t4             ;
  byte ch1;
   
   bsp_begin(bsp_nprocs());
   if (argc==1) {
    /* String length must be set as in SELEM  in bsp1.h not below*/
    printf("%s string-length(SELEM) nelements range(1..256) offset(0..255)\n",
           argv[0]);
    bsp_abort("Incorrect argument list\n");
   } 
   else {
     d= atoi(argv[1]);
     n= atoi(argv[2]);
     range= atoi(argv[3]);
     offset= atoi(argv[4]);
   }

   d=SELEM;

     init_params();
     for(i=0;i<n;i++) {
      for(j=0;j<d;j++) {
       data= (char)((unsigned char)(get_2_random(range)) + offset);
       fprintf(stdout, "%c", data) ;
      }
       fprintf(stdout, "\n") ;
     }

bsp_end();
}
