Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Private ReadOnly rng As New Random
- Sub Main()
- Dim arr = Enumerable.Range(1, 52).ToArray()
- Array.Sort(arr, AddressOf CompareIntegersByRandomDouble)
- Console.WriteLine()
- Console.WriteLine(String.Join(", ", arr))
- Console.ReadLine()
- End Sub
- Private Function CompareIntegersByRandomDouble(i1 As Integer, i2 As Integer) As Integer
- Return GetRandomDoubleForInteger(i1).CompareTo(GetRandomDoubleForInteger(i2))
- End Function
- Private Function GetRandomDoubleForInteger(i As Integer)As Double
- Dim d = rng.NextDouble()
- Console.WriteLine("Value: {0}; Key: {1}", i, d)
- Return d
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement