use triple ` to denote a code block; "his" => "their"
in general it’s difficult, for example, imagine generating a random Sudoku obeying uniform distribution.
But in your case, I think you can generate a rand(3) and normalize it so that the sum is 1, this should give a uniform distribution. (I think)
julia> a = Matrix{Float64}(undef, 10, 3);
julia> for i in 1:size(a)[1]
v = rand(3)
a[i,:] = v / sum(v)
end
julia> (sum(a, dims=2) .≈ 1) |> all
true
edit: I realized this the problem is highly dependent on what is the range of your ω s, and what is their distribution, in that regards, use Distributions.jl
Normalization, as suggested by @jling, is probably the simplest approach here, and the easiest to customize by using different univariate distributions.
You can also use a Dirichlet distribution to draw a random value in a simplex:
using Distributions
rand(Dirichlet(3, 2))
Finally, you can also use stick-breaking to transform 2 random values (but the result will not be symmetric unless you apply a correction):
using Random
function rand_simplex(rng, n)
z = 1.0
s = Vector{Float64}(undef, n)
for i in 1:(n-1)
r = rand(rng, Float64)
s[i] = z * r
z *= 1 - r
end
s[end] = z
s
end
rand_simplex(Random.GLOBAL_RNG, 3)
Thanks you both @jling and @Tamas_Papp for your aproaches, in all cases they were very useful to me, in particular I think I will lean towards the Dirichlet method of the distribution package.