Random vector generating - help

  • Thread starter Thread starter bgy
  • Start date Start date
  • Tags Tags
    Random Vector
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
bgy
Messages
7
Reaction score
0
hi,

I have to generate a random vector |Q>, which has the following form:

|Q>=a*(1,0)+b*(0,1), where |a*a|+|b*b|=1 and (...,...) is a 2 dimensional column vector.

This is a linear superposition of two vectors simply and the values of the vectors change between [0,1] randomly.

I think, I schould use Monte Carlo simulation method...

Please, if you have a source code (in C++), send me... this is very important!
 
Physics news on Phys.org
Monte Carlo ?!

Well, I would first generate a random number , let's say R in [0.0 , 1.0] interval.
Then I would evaluate X = 2Pi * R , and
a = sin X
b = cos X