BBO Discussion Forums: Random number in dealer - BBO Discussion Forums

Jump to content

Page 1 of 1

Random number in dealer how to generate a random number within limits

#1 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-15, 14:18

I recently discovered the option to program criteria for the hands generated to practice bidding with my partner. I must say, that I am excited!

One thing I am missing though is a random number generator. Nothing advanced, just the possibility to generator a random integer from a discrete uniform distribution, like a number between 0 and 9, all outcomes the same probability.

I have tried rand() and other C-like things without luck. Its gotta be there somehow, since the cards can be shuffled :-)

Is this possible?
0

#2 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,380
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2016-February-15, 15:27

View PostJ Lodahl, on 2016-February-15, 14:18, said:

I recently discovered the option to program criteria for the hands generated to practice bidding with my partner. I must say, that I am excited!

One thing I am missing though is a random number generator. Nothing advanced, just the possibility to generator a random integer from a discrete uniform distribution, like a number between 0 and 9, all outcomes the same probability.

I have tried rand() and other C-like things without luck. Its gotta be there somehow, since the cards can be shuffled :-)

Is this possible?


As far as I know, Dealer doesn't expose this kind of low level primitive, however, there are a bunch of useful higher level functions.
If you can give me a better idea what you are trying to do, I can probably suggest something reasonable.

If worst comes to worst, you can back out a random number generator using "hascard", but this seems like a stupid thing to do
Alderaan delenda est
0

#3 User is offline   thorvald 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 368
  • Joined: 2012-September-05
  • Gender:Male
  • Location:Denmark

Posted 2016-February-15, 18:11

Could you give an example of why you want the rand() function ?

I have used dealer for more than 20 years now, and never needed that function

Thorvald
Thorvald Aagaard
Mobile : +45 22 99 55 25
http://www.netbridge.dk
http://www.thorvald.dk
0

#4 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-16, 13:10

Thank you for your fast replies and interest.

If you think “Why would you need this” here are three examples:

1 Generate a hand fulfilling the specified criteria or – with a given probability – generate a hand which almost fulfils the criteria. I find this better training than all hands are fulfilling.

2. Generate a normal opening hand 11-21 HCP but even out the distribution so that more hands than normal are "good hands" (think part of a condition like e.g. hcp(north)>=11+r where r is random 0-10)

Or just

3. Generate a NT opening hand, equally likely to be 1NT or 2NT

Does this make sense?

I see the point of using available functions for “pseudo-random” but don’t see how?
0

#5 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,380
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2016-February-16, 14:01

View PostJ Lodahl, on 2016-February-16, 13:10, said:

Thank you for your fast replies and interest.

If you think “Why would you need this” here are three examples:

1 Generate a hand fulfilling the specified criteria or – with a given probability – generate a hand which almost fulfils the criteria. I find this better training than all hands are fulfilling.

2. Generate a normal opening hand 11-21 HCP but even out the distribution so that more hands than normal are "good hands" (think part of a condition like e.g. hcp(north)>=11+r where r is random 0-10)

Or just

3. Generate a NT opening hand, equally likely to be 1NT or 2NT

Does this make sense?

I see the point of using available functions for “pseudo-random” but don’t see how?


From the sounds of things you want to create discrete sets of hands and then mix them together based on some kind of PDF.

It's probably possible to do this within Dealer. Personally, I'd just use Dealer to pipe 100 hands of type foo to file A.
Pipe another 100 hands of type bar to file B and then use awk or PERL or some such to blend the files.
Alderaan delenda est
0

#6 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-17, 03:42

Hi Hrothgar,
no PDF. I would like to use the script for training bidding online with my partner.
0

#7 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,380
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2016-February-17, 05:42

View PostJ Lodahl, on 2016-February-17, 03:42, said:

Hi Hrothgar,
no PDF. I would like to use the script for training bidding online with my partner.


Generate the hand file using Dealer and then upload it to BBO
Alderaan delenda est
0

#8 User is offline   helene_t 

  • The Abbess
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 17,082
  • Joined: 2004-April-22
  • Gender:Female
  • Location:UK

Posted 2016-February-17, 08:41

View Posthrothgar, on 2016-February-16, 14:01, said:

PDF

Richard, please, you know very well how people interpret that abbreviation .....
The world would be such a happy place, if only everyone played Acol :) --- TramTicket
0

#9 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,380
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2016-February-17, 09:35

View Posthelene_t, on 2016-February-17, 08:41, said:

Richard, please, you know very well how people interpret that abbreviation .....


Sorry, when I said PDF I meant "Probability Density Function"
Alderaan delenda est
0

#10 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-17, 11:06

View Posthrothgar, on 2016-February-17, 09:35, said:

Sorry, when I said PDF I meant "Probability Density Function"


OK :-) That makes so much more sense. In the context talking about files I didn't get that. Also I was not aware of the possibility to read files with hands into BBO.

So it is a possibility to generate different kinds of hands, into separate files and then "blend" hands from the files in some post-script into a new file and load the blended file into BBO?
0

#11 User is offline   hrothgar 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 15,380
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Natick, MA
  • Interests:Travel
    Cooking
    Brewing
    Hiking

Posted 2016-February-17, 12:11

View PostJ Lodahl, on 2016-February-17, 11:06, said:

So it is a possibility to generate different kinds of hands, into separate files and then "blend" hands from the files in some post-script into a new file and load the blended file into BBO?


yes
Alderaan delenda est
0

#12 User is offline   thorvald 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 368
  • Joined: 2012-September-05
  • Gender:Male
  • Location:Denmark

Posted 2016-February-17, 18:09

View Posthrothgar, on 2016-February-17, 12:11, said:

yes


How do you upload the output from dealer ? (Maybe its more Where do you upload the output file from dealer ?)
Thorvald Aagaard
Mobile : +45 22 99 55 25
http://www.netbridge.dk
http://www.thorvald.dk
0

#13 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-18, 13:46

I also like the idea to use hascard as a way to have multiple 0/1 variable, (assume they are independent even though they are not) and then a function with weigthed-sum and modulo could do as a very primitive random function.
0

#14 User is offline   J Lodahl 

  • PipPip
  • Group: Members
  • Posts: 15
  • Joined: 2016-February-15

Posted 2016-February-26, 01:52

I would like to conclude on the topic.

I endende up with a very simple sum of hascard as indikator:

Rand=hascard(east,2C)+hascard(east,3S)+hascard(east,4D)+hascard(east,5H)+hascard(east,6D)+hascard(east,7S)+hascard(west,2H)+hascard(west,3C)+hascard(west,4H)+hascard(west,5S)+hascard(west,6C)+hascard(west,7D)

Rand is then binomial(12,25%) Strictly speaking the indicators are not independent, since they depend on the conditions for the hands in general but I have testet this on a simulation and absolutely no problem. Rand also have some slight correlation to the hand you are dealt, but I have never thought of that in the examples I have tried.

One example where I use this is:

SkipSmall=((Rand>=2) and (hcp(north)+hcp(south)<=24))

Just to giv you one specific.

Thanks all for the warm welcome in the forum.

Jørn
0

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users