- /* BRC PROBABILITIES */
- /* a typical code example:
- 46:if (random(slime*4)<4) and (tab[x,y+2] = 0) then\r
- Begin tab[x,y]:=0;col[x,y+2]:=col[x,y];tab[x,y+2]:=27;mat[x,y+2]:=9;Voice4:=2;end;\r
- where slime is the byte loaded from the file as it is.
- pascal random function generates a random number between 0..limit-1, inclusive, for random(limit).
-
- so a random number between 0..limit*4-1 is generated.
- for limit=1, 0..3, which is always < 4, so P=1.
- for limit=2, 0..7, 0..7 is < 4 in P=50%.
- for limit=3, 0..11, is < 4 in P=33%.
- So the probability is exactly 100%/limit.
- just make sure we do not divide by zero for some broken input.
+ // BRC PROBABILITIES
+ /*
+ a typical code example:
+ 46:if (random(slime*4)<4) and (tab[x,y+2] = 0) then
+ Begin tab[x,y]:=0;col[x,y+2]:=col[x,y];tab[x,y+2]:=27;mat[x,y+2]:=9;Voice4:=2;end;
+ where slime is the byte loaded from the file as it is.
+ pascal random function generates a random number between 0..limit-1,
+ inclusive, for random(limit).
+
+ so a random number between 0..limit*4-1 is generated.
+ for limit=1, 0..3, which is always < 4, so P=1.
+ for limit=2, 0..7, 0..7 is < 4 in P=50%.
+ for limit=3, 0..11, is < 4 in P=33%.
+ So the probability is exactly 100%/limit.
+ just make sure we do not divide by zero for some broken input.