GetRandomSubGroupEnum
- comment
- bug
Not an even distribution. See http://www.hiveworkshop.com/forums/l-715/g-275344/.
- patch
1.07
- Source
- Blizzard.j
- return type
nothing
- Source code
function GetRandomSubGroupEnum takes nothing returns nothing if (bj_randomSubGroupWant > 0) then if (bj_randomSubGroupWant >= bj_randomSubGroupTotal) or (GetRandomReal(0,1) < bj_randomSubGroupChance) then // We either need every remaining unit, or the unit passed its chance check. call GroupAddUnit(bj_randomSubGroupGroup, GetEnumUnit()) set bj_randomSubGroupWant = bj_randomSubGroupWant - 1 endif endif set bj_randomSubGroupTotal = bj_randomSubGroupTotal - 1 endfunction