种子随机数
9 个节点
本页内容 9
种子随机数
函数此节点没有文档说明。
种子随机数(种子: 整数) -> Seeded Random
SeededRandom SeededRandom(int seed = 1)
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 种子 | 整数 | 1 | Which stream. Any value is a valid seed, including zero and negative numbers - the output function scrambles the state thoroughly enough that neighbouring seeds give unrelated streams. |
返回
| 种子随机数 | Seeded Random |
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 数据流 函数 事件 例程 蓝图 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
已抽取次数
函数How many numbers have been drawn since the last SeededRandom.Restart.
已抽取次数(Seeded Random: Seeded Random) -> 大整数
long Draws(SeededRandom Seeded Random)
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
返回
| 结果 | 大整数 |
备注
The position in the stream, and therefore the other half of its reproducibility: two runs that agree
on the seed and on this have drawn the same numbers. Worth asserting in a scripted run, because a
game that draws a different NUMBER of times is just as unreproducible as one that draws different
values.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 数据流 函数 事件 例程 蓝图 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
种子
函数The seed this stream was made with.
种子(Seeded Random: Seeded Random) -> 整数
int Seed(SeededRandom Seeded Random)
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
返回
| 结果 | 整数 |
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 数据流 函数 事件 例程 蓝图 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
附近的下一个数
函数One of two numbers, either side of a middle, by an even coin flip.
附近的下一个数 -> 数字
Seeded Random: Seeded Random
中心: 数字
分布范围: 数字double NextAround(
SeededRandom Seeded Random,
double centre,
double spread)参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| 中心 | 数字 | — | |
| 分布范围 | 数字 | — |
返回
| 结果 | 数字 |
备注
The shape a spawner keeps needing: an obstacle's gap sits somewhere in a band around the centre of
the screen, and what varies is how far and which way. Saves a game writing the same two lines.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
区间内的下一个数
函数A number between two bounds, including the lower and excluding the upper.
区间内的下一个数 -> 数字
Seeded Random: Seeded Random
最小值: 数字
最大值: 数字double NextBetween(
SeededRandom Seeded Random,
double minimum,
double maximum)参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| 最小值 | 数字 | — | |
| 最大值 | 数字 | — |
返回
| 结果 | 数字 |
备注
Bounds the wrong way round are swapped rather than refused: a spawn range typed backwards is
a slip, and refusing it would take a game down mid-run for something with an obvious meaning.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
按概率判定
函数Whether a thing with this probability happened.
按概率判定(Seeded Random: Seeded Random, 概率: 数字) -> 真否
bool NextChance(
SeededRandom Seeded Random,
double probability = 0.5)参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| 概率 | 数字 | 0.5 | From zero (never) to one (always). |
返回
| 结果 | 真否 |
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
下一个 0 到 1 之间的数
函数A number from zero up to but not including one.
下一个 0 到 1 之间的数(Seeded Random: Seeded Random) -> 数字
double NextUnit(SeededRandom Seeded Random)
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
返回
| 结果 | 数字 |
备注
Built from the top 53 bits, which is exactly what a double's mantissa holds - so every value is
representable and the distribution is even. Taking the low bits instead is the classic way to get a
generator that is subtly worse than the one it wraps.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
下一个整数
函数A whole number from the lower bound up to but not including the upper.
下一个整数 -> 整数
Seeded Random: Seeded Random
最小值(含): 整数
最大值(不含): 整数int NextWhole(
SeededRandom Seeded Random,
int minimumInclusive,
int maximumExclusive)参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| 最小值(含) | 整数 | — | |
| 最大值(不含) | 整数 | — |
返回
| 结果 | 整数 |
备注
An empty or backwards range answers the lower bound, and draws nothing - there is no number
to pick, and advancing the stream for a question with no answer would make the sequence depend on how
often a game asked an impossible one.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时
重新开始
函数Go back to the beginning of the stream.
重新开始(Seeded Random: Seeded Random)
void Restart(SeededRandom Seeded Random)
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
备注
What restarting a run means for the spawner: the same seed gives the same world again.
- 所属发行版
- 元编程(教育版)元编程(专业版)
- 可用的图种类
- 事件 例程 状态机状态
- 声明于
- 种子随机数
- 所属包
- Glaze 实时