Jump to content

Random number in dealer


J Lodahl

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...