How to create random matrix od complex numer, this way is only for Real part of this.
julia> Complex.(rand(5))
5-element Array{Complex{Float64},1
0.5247641513084038 + 0.0im
0.1119184762223755 + 0.0im
0.30371961835824224 + 0.0im
0.7391045824296607 + 0.0im
0.7081602943302652 + 0.0im
Thx. Paul
rand(Complex{Float64}, 10)
3 Likes
what if i don’t want values between 0 and 1 but any float64 complex numbers from 0 to 10 for example?
Apply a function that transforms 0…1 to the range you desire
julia> 10.0*rand(Complex{Float64}, 10)
10-element Vector{ComplexF64}:
2.360001657296227 + 4.066247173406985im
7.465908433116299 + 7.9868729179894355im
6.345030432889454 + 2.638389800007437im
0.7051203542985185 + 3.2030447347746316im
7.710712462960087 + 7.9851302065761836im
2.6223247811513706 + 8.920949876665079im
2.5041800274421044 + 3.8916846587780096im
0.36766752355370524 + 2.129320929229639im
7.284979443674359 + 7.29620098936355im
0.5610022220270849 + 3.079778973656515im
1 Like