以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [分享]简单实现对集合数组类内容(如人名清单)进行随机排序  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=185769)

--  作者:qqzwc
--  发布时间:2023/3/15 16:57:00
--  [分享]简单实现对集合数组类内容(如人名清单)进行随机排序
\'对人名进行随机排序为例

\'准备要排序的内容
Dim names As New List(Of String) From {"刘一", "陈二", "张三", "李四", "赵五", "王六", "孙七", "周八", "吴九", "郑十"}

\'执行随机排序
Dim sortedNames = names.OrderBy(Function(x) Rand.Next())

\'显示排序结果
For Each nm As String In sortedNames
    Output.Show(nm)
Next
[此贴子已经被作者于2023/3/15 17:26:31编辑过]