LB Booster
General >> General Board >> propebility and chance
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1458393631

propebility and chance
Post by bluatigro on Mar 19th, 2016, 1:20pm


try at properbility and chance functions

this can have errors

Code:
for a = 1 to 10
  for b = 1 to a
    print over( a , b ) ; " " ;
  next b
  print
next a
print "chance on a hart or face card ."
print p.str$( p.l( 13/52 , 12/52 ) )
print "chance of picking 4 boys out of groop of 5 boys and 4 girls ."
pickboys = 4
boys = 5
girls = 4
groops = over( boys , boys + girls )
boygroops = over( pickboys , boys )
print p.str$( boygroops / groops )
print "chance of picking ful house ."
groops = over( 5 , 52 )
print p.str$( 4 / groops )
print "chance of 10 dices no 6 ."
print p.str$( p.not( ( 5 / 6 ) ^ 10 ) )
end
function p.not( a )
  p.not = 1 - a
end function
function p.and( a , b )
''p( a and b )
  p.and = a * b
end function
function p.add( a , b )
''p( a or b )
''mutali excusif events
  p.add = a + b
end function
function p.or( a , b )
''p( a or b )
''not mutali excusif events
  p.or = a + b - p.and( a , b )
end function
function p.l( a , b )
''p( a | b )
  p.l = p.and( a , b ) / b
end function
function p.str$( a )
  p.str$ = str$( a * 100 ) + " %"
end function
function f( x )
'' x!
  uit = 1
  if x > 1 and x < 60 then
    uit = x * f( x - 1 )
  end if
  f = uit
end function
function over( a , b )
  over = f( a ) / ( f( a - b ) )
end function
function over2( a , b )
  over2 = f( a ) / ( f( b ) * f( a - b ) )
end function