Recent content by 3HeadedMonkey

  1. 3

    Generate a uniform random vector

    It's not due to the poor randomness of the C random(). It's because you divide a random variable by the SUM of N random variables. The variance changes (this may be also because one variable of the sum at the denominator is the variable at the numerator). I tried it even with BOOST libraries...
  2. 3

    Generate a uniform random vector

    Yes, but the sum of N random variables is not a constant :wink: By normalizing you get each variable as the result of a uniform random variable divided for a sum of uniform random variables.
  3. 3

    Generate a uniform random vector

    I tried to "uniformize" the resulting variables by generating angles with a distribution such that there were more angles near π/4, but it didn't work properly. I think it was because each angle uses a certain combination of cos and sin in the conversion to cartesian coordinates. Maybe I should...
  4. 3

    Generate a uniform random vector

    I have to think about this. If I want this, I can do it by repeatedly folding the hyperspace. I already coded it and it works. In this case the single elements are not uniform. But maybe the right thing to do. I explain better the problem: This vector is the input of an heuristic optimization...
  5. 3

    Generate a uniform random vector

    Thank you, i could try to look at this later, now i returned to use the normalization (much easier than the angles generation and equally bad :wink:)
  6. 3

    Generate a uniform random vector

    Yes, easy but wrong. In fact if you look at the plot of sin and cos you see that there are more points in the codomain when sin and cos come near to 1. My original idea was to find a distribution (not uniform) to generate these angles such that the result of sin and cos would be uniform. I...
  7. 3

    Generate a uniform random vector

    ok this is what i feared. Thank you anyway :smile:
  8. 3

    Generate a uniform random vector

    Take the case with N=2 Generate v[0] as uniform[0,1] Calculate v[1] as 1-v[0] Result: 2 uniform variables (not independent but uniform) If you plot the frequencies of the two variables, the plots are "flat". I mean each of the two variables is uniformly distributed. Obviously v[1] is uniform...
  9. 3

    Generate a uniform random vector

    Hi chiro, thanks for the reply. If you generate N variables and then you divide by the total sum you no longer have N uniform random variables. If you try, you can see that the plot of the frequencies of a single variable is no longer "flat". I could try to use R, but only a question: can I...
  10. 3

    Generate a uniform random vector

    Hi all, I'm trying to generate uniform random vectors with n dimensions. To be more precise, each of the elements of the vector must be a uniform distributed variable in [0,1] The constraint is that the sum of the elements of the vector must be 1. I tried different solutions for over a week but...
Back
Top