Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Surprised by randcycle

$
0
0

Hi, first time poster here!

I am fooling around with cyclic permutations today in Julia 1.4.2 and was surprised to see that the randcycle function in Random do not include the identity permutation. As an example:

julia> Set([randcycle(3) for _ in 1:1000])
Set{Array{Int64,1}} with 2 elements:
  [2, 3, 1]
  [3, 1, 2]

I was expecting 3-element Array{Int64,1}: 1 2 3 to also be in the returned set. Am I missing something elementary here?

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles