# so i found a way to beat casino unless theres something wrong in this short program

• ### General discussion

• bob=0
'bob is the gambler and he starts with zero euros
bet=10
'the initial amount is a bet of ten euro
re:
a= Math.GetRandomNumber(2)
'its a gamble at 50%
If a=1 Then
bob=bob+bet
bet=bet*0.5
'when i win i decrease my initial bet a 50%
Else
bob=bob-bet
bet=bet*1.5
'when i lose i increase my initial bet a 50%
EndIf
If bet<1 Then
bet=10
' the bet has a natural tendency to reduce by chance so when it goes below one i reset it to 10
EndIf
Goto re

so could anybody point me please whats wrong with this program?

Sunday, November 6, 2016 9:26 PM

### All replies

• There may not be a 50% chance for the win rate. For example here it says the win rate for Roulette may be as low as 25% or so. In addition you need to specify a game for the math to work. Also to my understanding Math.GetRandomNumber is a pseudo-number generator and in reality is not actually random so that may also skew things a bit due to the calculations drifting away from reality.
Sunday, November 6, 2016 10:38 PM
• here the program modified to render a casino roultette with its edge agains the player, still it gets winnings, maybe the random number generator is wrong or theres something with the program?:

bob=0
'bob is the gambler and he starts with zero euros
bet=10
'the initial amount is a bet of ten euro
re:
a= Math.GetRandomNumber(37)
'its a gamble at roulette betting number will be minor than 19,theres 1/37 edge against bob
If a<19 Then
bob=bob+bet
bet=bet*0.5
'when i win i decrease my initial bet a 50%
Else
bob=bob-bet
bet=bet*1.5
'when i lose i increase my initial bet a 50%
EndIf
If bet<1 Then
bet=10
' the bet has a natural tendency to reduce by chance so when it goes below one i reset it to 10
EndIf
Goto re

Sunday, November 6, 2016 10:55 PM
• Hi Antonio

the random number may be a little more complex by using 3 random numbers , and add it together,

try this one:

__________________________________________________________________________________________

bob=0
'bob is the gambler and he starts with zero euros
bet=10
'the initial amount is a bet of ten euro
While "TRUE"

A=Math.GetRandomNumber(10)
B=MATH.GetRandomNumber(13)
C=MATH.GetRandomNumber(14)

N=A+B+C

'its a gamble at roulette betting number will be minor than 19,theres 1/37 edge against bob
If N<19 Then
bob=bob+bet
bet=bet*0.5
'when i win i decrease my initial bet a 50%
Else
bob=bob-bet
bet=bet*1.5
'when i lose i increase my initial bet a 50%
EndIf
If bet<1 Then
bet=10
' the bet has a natural tendency to reduce by chance so when it goes below one i reset it to 10
EndIf
Program.Delay(300)
EndWhile

_________________________________________________________________________________________

Monday, November 7, 2016 12:08 AM
• yes but like with that method of selecting a random number the minimum number picked is 3

i improved the program, i guess if its right you could also send info faster than light :)

bob=0
'bob is the gambler and he starts with zero euros
bet=10
'the initial amount is a bet of ten euro
re:
a= Math.GetRandomNumber(37)
'its a gamble at roulette betting number will be minor than 19,theres 1/37 edge against bob
If a<19 Then
bob=bob+bet
bet=bet*0.5
'when i win i decrease my initial bet a 50%
Else
bob=bob-bet
bet=bet*1.5
'when i lose i increase my initial bet a 50%
EndIf
If bet<1 Then
bet=10
' the bet has a natural tendency to reduce by chance so when it goes below one i reset it to 10
EndIf
'when i lose a total 0f 20000 euro i retire this was missing in the previous program
If bob<-10000 and alice<-10000 Then
Goto finish
endif
'i keep an extra deposit call alice in which i put or take money
If bob<950 Then
alice=alice-50
bob=bob+50
EndIf

If bob>1050 Then
alice=alice+50
bob=bob-50
EndIf

Goto re
finish:

Monday, November 7, 2016 5:43 AM
• Who is Alice??

Monday, November 7, 2016 1:01 PM
• To see if there is a bias in Math.GetRandomNumber(2):

```For j=1 To 10
For i=1 To 800000
m=Math.GetRandomNumber(2)
If m=1 Then
cnt=cnt+1
EndIf
endfor
TextWindow.WriteLine(cnt)
cnt=0
EndFor```

Jan [ WhTurner ] The Netherlands

Monday, November 7, 2016 4:11 PM
• Who is Alice??

alice would be bob the gamblers bank

every game he is below 950 he withdraws 50 and every time he is above 1050 he saves 50 in the bank

Monday, November 7, 2016 4:23 PM
• added ldgraph to display wins&looses: NBH015

Monday, November 7, 2016 7:21 PM
• i dont think its anything with the random number generator

check this program which simulates a stock market in which you can win or lose a 10% on a 51% chance on your favour

bob=1000000000000
re:
a= Math.GetRandomNumber(100)
If a<52 Then
bob=bob*1.1
Else
bob=bob*0.9
EndIf
TextWindow.WriteLine(bob)

Goto re
Tuesday, November 8, 2016 4:14 PM
• Hi Antonio !

for a sampling of 1000 times starting with \$1000 , i end up with 865\$

with this modified program:

_______________________________________________________________________________________

bob=1000
' FOR A SAMPLING OF 1000 TIMES

For SAMPLING = 1 To 1000

X = Math.GetRandomNumber(2)
If X=1 Then

bob=bob*1.1
bob=Math.Round(bob*100)/100
Else
bob=bob/1.1
bob=Math.Round(bob*100)/100
EndIf
TextWindow.WriteLine(bob)
' Program.Delay(500)

____________________________________________________________________________________________

Tuesday, November 8, 2016 6:49 PM