scala中随机数
改组列表元素 (Shuffling list elements)
Shuffling list elements is randomizing the index of elements of the list. So, list('A', 'B', 'C', 'D') will be shuffled as list('C', 'A', 'D', 'B').
改组列表元素正在随机化列表元素的索引。 因此, list('A','B','C','D')将作为list('C','A','D','B')改组。
To shuffle elements of a list we will be using the shuffle method of the Random class.
要随机播放列表中的元素,我们将使用Random类的shuffle方法。
Syntax:
句法: