當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Julia Random.randperm!用法及代碼示例

用法:

randperm!([rng=GLOBAL_RNG,] A::Array{<:Integer})

A 中構造長度為 length(A) 的隨機排列。可選的 rng 參數指定一個隨機數生成器(參見 Random Numbers )。要隨機置換任意向量,請參閱 shuffle shuffle!

例子

julia> randperm!(MersenneTwister(1234), Vector{Int}(undef, 4))
4-element Vector{Int64}:
 2
 1
 4
 3

相關用法


注:本文由純淨天空篩選整理自julialang.org 大神的英文原創作品 Random.randperm! — Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。