Random vector generating - help

  • Thread starter Thread starter bgy
  • Start date Start date
  • Tags Tags
    Random Vector
AI Thread Summary
To generate a random vector |Q> in the form |Q> = a*(1,0) + b*(0,1), where |a|^2 + |b|^2 = 1, a Monte Carlo simulation method is suggested. The process involves generating a random number R in the interval [0.0, 1.0], then calculating X as 2π * R. The values of a and b are derived using the sine and cosine functions, respectively, where a = sin(X) and b = cos(X). This approach ensures that the resulting vector maintains the required normalization condition. The request for C++ source code indicates a need for practical implementation guidance.
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!
 
Technology 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
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Back
Top