Re: function for generating array of unique indicies

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 14 Sep 2007 15:46:12 -0600 (MDT)

Sorry, all, several people contacted me about the misspelling of
"indices". I promise, this will be correct by the time the function is
released.

--Mary

On Fri, 14 Sep 2007, Mary Haley wrote:

>
> Hi all,
>
> A few people have asked us how to generate an array of unique
> integer indicies. We have added a new function that will be in
> the next release, but it is simple enough to share here.
>
> Both Christophe Cassou [CERFACS, Toulouse CEDEX France] and Dennis
> Shea contributed to this fairly elegant solution. Note that the
> function will be called "generate_unique_indicies", but I've renamed
> it here to keep it conflicting with the new one coming up:
>
> undef("gen_uniq_indicies")
> function gen_uniq_indicies( N:integer)
> local r
> begin
> r = random_uniform(0,100,N)
> return( dim_pqsort(r, 1) )
> end
>
> To call it, you give it the number of unique indicies you want:
>
> i = gen_uniq_indicies(50)
>
> --Mary
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 14 2007 - 15:46:12 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 17 2007 - 14:58:21 MDT