元編程參考文件

排列與匹配

4 個節點

本頁內容 4

最大匹配

函數

As many pairs as can be made between a left set and a right set, each pair along an allowed edge and nothing used twice: workers to jobs, players to seats. The nth edge joins left[n] to right[n].

簽名
最大匹配 -> (對數: 整數, 配對: 整數陣列)
    左側數量: 整數
    右側數量: 整數
    邊的左端: 整數陣列
    邊的右端: 整數陣列
int MaximumMatching(
    int leftCount,
    int rightCount,
    int[] edgeLefts,
    int[] edgeRights,
    out int[] partners)

參數

名稱型別預設值說明
左側數量整數—How many on the left, numbered from 0.
右側數量整數—How many on the right, numbered from 0.
邊的左端整數陣列—Each allowed edge's left end.
邊的右端整數陣列—Each allowed edge's right end.

返回

對數整數
配對整數陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
排列與匹配
所屬包
罪案引擎

隨機排列

函數

The numbers 0 to count - 1 in a random order.

簽名
隨機排列(數量: 整數, 種子: 整數) -> 整數陣列
int[] Permutation(int count, int seed = 1)

參數

名稱型別預設值說明
數量整數—How many.
種子整數1The same seed gives the same order.

返回

順序整數陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
排列與匹配
所屬包
罪案引擎

隨機抽樣

函數

Some of the numbers 0 to from - 1, none twice, in a random order.

簽名
隨機抽樣(抽取數量: 整數, 總數: 整數, 種子: 整數) -> 整數陣列
int[] Sample(int count, int from, int seed = 1)

參數

名稱型別預設值說明
抽取數量整數—How many to take.
總數整數—How many there are to take from.
種子整數1The same seed gives the same sample.

返回

樣本整數陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
排列與匹配
所屬包
罪案引擎

打亂數字

函數

The numbers in a random order.

簽名
打亂數字(數字: 整數陣列, 種子: 整數) -> 整數陣列
int[] Shuffle(int[] values, int seed = 1)

參數

名稱型別預設值說明
數字整數陣列—The numbers.
種子整數1The same seed gives the same order.

返回

打亂後整數陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
排列與匹配
所屬包
罪案引擎