I have two vectors
A
B
which are coupled, I mean that they define a certain scalar field at a given position.
I want to select 1000 random items from A and plot them versus other the other 1000 B coupled items.
With this code
A_rand=random.sample(A,1000)
I select 1000 random values of A. For example they are A[1],A[50],A[49], etc.
How can I select B[1],B[50],B[49],etc. ?
I tried
B_rand=B[(A==A_rand)]
but it returned just one value. What am I doing wrong?
You can select indexes, not items:
Then you can use
A[rand[i]]andB[rand[i]].For all selected items: