Main Menu

Recent posts

#32
OxygenBasic / Re: Long time no news
Last post by Zlatko Vid - January 05, 2026, 10:29:48 AM
so called "AI" almost know nothing about Oxygen basic
and i think that this is good ...yes
Some people really think that AI can replace live programmer
in some cases probably will.

IF the coder aka prpgrammer don't know how to properly
ask AI then that one will get bad result.
And that is all hype about AI.


btw
number of downloads on sourceForge jump on 300 last week.
that is good i think... ;D
#37
OxygenBasic Examples / Re: Chances / Probability
Last post by Nicola - December 31, 2025, 06:38:28 PM
Hi,
combinations of n items chosen k at a time


'Le combinazioni rispondono a questa domanda:
'In quanti modi posso scegliere k elementi da un insieme di n elementi, senza ordine e senza ripetizione?
'
'Esempio classico:
'"Quanti gruppi da 3 persone posso formare con 8 persone?"
'Qui l'ordine non conta:
'il gruppo (A,B,C) è lo stesso di (C,B,A).
'---------------------------------------------------------------

' Calcola le combinazioni C(n, k) come float
function Comb(n as int, k as int) as double
    int i, kk
    double num = 1.0
    double den = 1.0

    ' Symmetry: C(n,k) = C(n,n-k)
    kk = k
    if kk > n - kk then kk = n - kk

    if kk < 0 or kk > n then
        return 0
    elseif kk = 0 or kk = n then
        return 1
    end if

    for i = 1 to kk
        num *= (n - kk + i)
        den *= i
    next

    return num / den
end function


'nel caso ci sono 3 palline rosse in un gruppo di 8 palline
'la probabilità che si riesca a pescare 3 palline tutte rosse
'viene calcolata
float num, den
num=Comb(3, 3) 'c'è un solo modo per prendere tutte e 3 rosse
den=Comb(8, 3) ' 56 è il numero delle cominazione totali a 3 a 3
double p = num/den * 100

print "P(all red) = " p
#38
OxygenBasic Examples / Re: Chances / Probability
Last post by Charles Pegge - December 30, 2025, 08:01:01 PM
factorials can also be used to solve this problem:

( 3! * 5! ) / 8!

which expands to:

( 2 * 3 * 2 * 3 * 4 * 5 ) / ( 2 * 3 * 4 * 5 * 6 * 7 * 8 )

which reduces to:

1/( 7*8 )

1 / 56
#39
OxygenBasic Examples / Re: Chances / Probability
Last post by Zlatko Vid - December 30, 2025, 04:06:31 PM
 :o
#40
OxygenBasic Examples / Re: Chances / Probability
Last post by Charles Pegge - December 29, 2025, 06:59:55 PM
Quote8 snooker balls are contained in a bag. Only 3 balls are colored red. What is the probability that when you randomly pick 3 balls out of the bag, they are all red?

No, the macro does not fit the task.

One solution:

(3/8) * (2/7) * (1/6) =

1/56