找不到shuffle函数

Julia1.1.0
%E5%9B%BE%E7%89%87

julia> using Random

julia> shuffle
shuffle (generic function with 2 methods)

help?> shuffle
search: shuffle shuffle!

  shuffle([rng=GLOBAL_RNG,] v::AbstractArray)

  Return a randomly permuted copy of v. The optional rng argument
  specifies a random number generator (see Random Numbers). To permute v
  in-place, see shuffle!. To obtain randomly permuted indices, see
  randperm.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> rng = MersenneTwister(1234);
  
  julia> shuffle(rng, Vector(1:10))
  10-element Array{Int64,1}:
    6
    1
   10
    2
    3
    9
    5
    7
    4
    8

刚开始学习编程经常遇见小问题,谢谢回答

找不到函数 help 不给力的时候可以去文档上搜。

help 只能搜索已导入(usingimport)的库

1 个赞

文档把元编程之前的都看了,之前不知道那里能搜索,学到了,谢谢!

或者用 apropos 搜,我不知道为什么这个函数几乎没人用。

julia> apropos("shuffle")
Random.shuffle!
Random.randperm!
Random.randperm
Random.shuffle

4 个赞

名字取得不好,存在感太低吧。应该考虑在 help 搜没有结果的时候返回 apropos 的搜索结果,或者给个提示可以用 apropos 搜。