语言

Extensions.RandomNext(IMemory, Int32, Int32, Nullable<Int32>) 方法

定义

生成器随机种子和属性的值。 如果值不是空,模拟随机值结果为:最小值 + (值 % (最大值 - 最小值))。 否则如果种子不是空的,随机的种子将被固定。

public static int RandomNext(this AdaptiveExpressions.Memory.IMemory memory, int min, int max, int? seed = default);
static member RandomNext : AdaptiveExpressions.Memory.IMemory * int * int * Nullable<int> -> int
<Extension()>
Public Function RandomNext (memory As IMemory, min As Integer, max As Integer, Optional seed As Nullable(Of Integer) = Nothing) As Integer

参数

memory
IMemory

记忆状态。

min
Int32

返回的随机数的非独占下限。

max
Int32

返回的随机数的独占上限。 最大值必须大于或等于最小值。

seed
Nullable<Int32>

用户种子。

返回

随机种子和价值。

适用于