美文网首页
Swift_Array.shuffled()

Swift_Array.shuffled()

作者: Eyes_cc | 来源:发表于2020-03-17 11:18 被阅读0次

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

/// 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]

相关文章

网友评论

      本文标题:Swift_Array.shuffled()

      本文链接:https://www.haomeiwen.com/subject/vuwzehtx.html