Hi Debasish,
There's a question on this in the FAQ, so I took that and modified it a little:
nvals = 30
narr = 1000
;---Generate 1000 x 30 random numbers
r = random_uniform(0,1,(/narr,nvals/)) ; random numbers
;---Sorting the values and keeping the indexes gives us random indexes.
indexes = dim_pqsort(r, 1)
;---Debug print
do i=0,narr-1
str = ""
do j=0,nvals-2
str = str + " " + indexes(i,j)
end do
print("" + str)
end do
You can use the "indexes" variable to index your array of 30 numbers.
--Mary
On Dec 21, 2011, at 1:17 PM, Debasish wrote:
> Dear NCL users,
>
> I have an array with 30 numbers. Now I would like to create 1000 arrays using this 30 numbers randomly and size of the each new array is also 30.
>
> example: Input array x = (x1, x2, x3, x4,......................,x30)
>
> Output 1000 arrays X1, X2, X3,..............,X1000 and dimension of XI (where I =0, 1000) is 30
> where
> X1 = (x21, x12, x3, x24,......................,x5)
> X2 = (x1, x20, x13, x24, x24, x24, ......................,x1)
> X3 = (x15, x25, x19, x14, x22, x10, x12,x12,......................,x7)
> .
> .
> .
> X1000 = (x10, x29, x13, x29, x13, x15......................,x6)
>
> Could you please let me know the suitable function in NCL that solves this problem
>
> with regards
>
> Debasish
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 21 13:21:22 2011
This archive was generated by hypermail 2.1.8 : Wed Jan 04 2012 - 10:18:09 MST