thanks a lot guys...

On Sep 19, 7:22 pm, Don <dondod...@gmail.com> wrote:
> This depends on rnd being a good pseudo-random generator. I don't
> suggest using the RNG built into many compilers. Instead use something
> like the Mersenne Twister which produces much better results with an
> extremely long period. My Random class has a "gen" method which
> returns an integer in the range 0..n-1.
>
> int *shuffle(int n)
> {
>   int *result = (int *)malloc(n * sizeof(int));
>   result[0] = 0;
>   for(int i = 1; i < n; ++i)
>   {
>     int j = rnd.gen(i+1);
>     result[i] = result[j];
>     result[j] = i;
>   }
>   return result;
>
> }
>
> On Sep 17, 12:12 pm, sivaviknesh s <sivavikne...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Write a method fill up an array of size n - and returns the array to the
> > caller - with the following conditions
>
> > 1. the numbers shud be between 0 to n-1
> > 2. no repeated numbers
> > 3. the method should have a deterministic time to fill the arrays
> > 4. arrays returned from the method should have low-correlation factor
>
> > ...btw what does 4 th point mean? what is a correlation factor?? Plz provide
> > code and explain...
>
> > --
> > Regards,
> > $iva

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to