Swift_Array.shuffled()

2020-03-17  本文已影响0人  Eyes_cc

【使用】:返回打乱的元素序列。

/// Returns the elements of the sequence, shuffled.
/// : 返回打乱的元素序列。
///
/// For example, you can shuffle the numbers between `0` and `9` by calling
/// the `shuffled()` method on that range:
/// : 例如,你可以通过在数组上调用shuffled()方法来打乱‘0’和‘9’之间的数字:
///
///     let numbers = 0...9
///     let shuffledNumbers = numbers.shuffled()
///     // shuffledNumbers == [1, 7, 6, 2, 8, 9, 4, 3, 5, 0]
@inlinable public func shuffled() -> [Base.Element]
上一篇 下一篇

猜你喜欢

热点阅读