nhavt
nhavt

Reputation: 349

Julia: UndefVarError: randperm not defined

I am currently staring with Julia 1.0.0 under Windows 10. When using a function randperm(n) where n is an integer number, I got an error message:

ERROR: UndefVarError: randperm not defined.

Presumably, I have not loaded a library that contains this function. So, could anyone please tell me which library should I load so that I can use that function? Thank you in advance!

Nha

Upvotes: 1

Views: 2408

Answers (1)

Bogumił Kamiński
Bogumił Kamiński

Reputation: 69949

You need to load standard library Random, e.g.:

julia> using Random

julia> randperm(10)
10-element Array{Int64,1}:
  6
  3
  7
 10
  2
  8
  5
  9
  4
  1

Upvotes: 1

Related Questions