種子隨機數
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 即時