Casino_plus is a C++ library for creating both uniform and non-uniform random distributions. The good thing about this library is, it has python language bindings as well, so you can use it in your python projects as well.
This library has a very easy to use interface for python programmers, also it is really fast.
In this article, I want to show you how to use python bindings of this library. So let's begin
Installation
the installation process is fairly simple. here is the requirements:
- Visual C++ build tools 2017 or higher
- CMake version 3.8 or higher
here is the github repo:
Amohammadi2 / Casino_plus
create uniform and non-uniform distribution
first go ahead and clone the repository:
$ git clone https://github.com/Amohammadi2/Casino_plus.git
Then, cd
into the project root directory, there you can find a setup.py file. (installation verified on python version 3.8)
$ python setup.py install
If you have the required tools installed, the installation will finish successfully.
How to use it
you have to import the module before you can use it, write the following code in a python file:
import CasinoPlus
the module contains a class called CasinoRandomGenerator
but due to constraints of C++ type system, there are some prefixes that you should use based on the data type you want to pass to the generator.
- s_ : for generators containing strings
- cs_ : for generators containing chars
- i_ : for generators containing ints
- f_ : for generators containing floats
- d_ : for generators containing doubles
for example you could use: s_CasinoRandomGenerator
to create a generator that accepts string items
at the time being, only the types mentioned above are supported. We'll try to improve it and make it more general.
adding items to the generator
to add items to the generator, you should use one of the methods add_item
or add_sequence
.
-
add_item(item: Item_Type, probability: int) -> None
: adds one item to generator with specified probability. for uniform distributionsprobability
could be set to 1 for all the items but if you want to create non-uniform random distributions, you can change this value. For example if you want the item to appear more frequently, you can increase the probability. probability cannot be a negative value. -
add_sequence(items: List[Tuple[Item_Type, int]]) -> None
: can add multiple items at once. it is more optimal to use this function when you want to add multiple items to the generator.
notice that Item_Type
is actually the data type that the generator is using for example if you're using s_CasinoRandomGenerator
then Item_Type would be str
.
getting a random item out of generator
in order to get a random item, you should use get_random_item
method. It has the following signature:
get_random_item() -> Item_Type
example
here is a example program that uses all the functionalities of CasinoPlus.
>>> from CasinoPlus import s_CasinoRandomGenerator as strgen
>>>
>>> rand = strgen()
>>> rand.add_item("Ashkan Mohammadi", 1)
>>> my_brothers = [["Arshia Mohammadi", 1], ["Ilia Mohammadi", 1]]
>>>
>>> rand.add_sequence(my_brothers)
>>> rand.get_random_item()
'Ilia Mohammadi'
>>> rand.get_random_item()
'Ashkan Mohammadi'
>>> rand.get_random_item()
'Arshia Mohammadi'
Top comments (13)
Recently, I have started to get involved in various gambling games. I also like to invest in cryptocurrency. So when I found a good one it's bitcoin casino australia betpokies.com/crypto-casinos , I was very happy about it. Since this allowed me to withdraw my winnings into cryptocurrency without any problems and invest it in the stock market! It's very useful and cool!
Hello, to all those who like to play in a free minute. I stalled my choice at online casinos, and I think that many will support me in this. Because if you approach the game wisely, you can still make good money on this. If you are also interested in this topic, I advise you to read about big time gaming online casinos. This is often the most productive way to get acquainted with gambling platforms.
You have a well-written post. This code helps my business. I am working a casino club, So i have need this type code. if you want to check my club ad club offer, So you have a peek at these guys. I hope so, You will focus on this.
Resort gambling combines luxury and excitement, offering visitors a mixture of relaxation and exciting casino events. These resorts often feature world-class amenities and entertainment, attracting tourists from all over the world. You can also check out 91club if you are interested. Here you can find the same games, only online.
Guys, this betsofa.com/ is a normal casino! The minimum deposit is only $10, and you can scroll for a week. And there cashback will get. All my friends are here, so I also decided to keep up with my friends. None of us have become a millionaire yet, but it's not over yet! Some of us dream of collecting an apartment or a car in this way. I understand that this is unrealistic, but if you like it, then let yourself. After all, a game is needed for thrill. And the efficiency and functionality of this site allow you to enjoy such moments to your heart's content.
Ebben az Γ‘ttekintΓ©sben rΓ©szletesen megvizsgΓ‘ljuk a mostbet-hu.com/promocios-kod-bonusz/ Γ‘ltal kΓnΓ‘lt promΓ³ciΓ³s kΓ³dokat Γ©s bΓ³nuszokat. A platform rendszeresen kΓnΓ‘l kΓΌlΓΆnbΓΆzΕ promΓ³ciΓ³kat, amelyek nΓΆvelik a felhasznΓ‘lΓ³k jΓ‘tΓ©kΓ©lmΓ©nyΓ©t Γ©s esetleges nyerΓ©si lehetΕsΓ©geit. A promΓ³ciΓ³s kΓ³dok lehetΕsΓ©get kΓnΓ‘lnak a felhasznΓ‘lΓ³knak extra bΓ³nuszok Γ©s elΕnyΓΆk igΓ©nylΓ©sΓ©re. A kΓ³dokat Γ‘ltalΓ‘ban a regisztrΓ‘ciΓ³ vagy befizetΓ©s sorΓ‘n lehet hasznΓ‘lni, Γ©s ezek segΓtenek fokozni az indulΓ³ tΕkΓ©t. Az ΓΊj felhasznΓ‘lΓ³k gyakran rΓ©szesΓΌlnek ΓΌdvΓΆzlΕ bΓ³nuszokban, amikor regisztrΓ‘lnak Γ©s elindΓtjΓ‘k a jΓ‘tΓ©kukat. Ez lehet extra pΓ©nz a befizetΓ©sekhez vagy ingyenes fogadΓ‘sok a platform kΓnΓ‘latΓ‘ban. A Mostbet-hu.com idΕszakonkΓ©nt ΓΊj Γ©s izgalmas promΓ³ciΓ³kat kΓnΓ‘l. Ezek lehetnek szezonΓ‘lis ajΓ‘nlatok, kΓΌlΓΆnleges esemΓ©nyekhez kapcsolΓ³dΓ³ promΓ³ciΓ³k vagy akΓ‘r versenyek, amelyeken valΓ³ rΓ©szvΓ©tel extra jutalmakat hozhat. A platform gyakran kΓnΓ‘l bΓ³nuszokat a felhasznΓ‘lΓ³knak, akik bizonyos feltΓ©telekkel befizetΓ©st hajtanak vΓ©gre. Ez lehet a befizetett ΓΆsszeg szΓ‘zalΓ©kos nΓΆvekedΓ©se vagy extra pΓ©nz a szΓ‘mlΓ‘ra.
top, thx
I like betting on badminton because you can predict the exact score of the match. Again, few variations are possible - 2-0, 2-1, 1-2, 0-2. In our game, a 2-0 bet will be played. The odds are usually pretty high for such bets, but they are not that difficult to predict. The situation is much more difficult when you need three games to win, but it is not recommended that beginners bet on the exact score in such games. The exact score in a game is also suggested. But as a betting man, I started betting at fairplay-club.in/app/ a long time ago and still do. And I like this stability because I prefer only the tried and tested bookmakers.
Very interesting article! But you know, I'm quite a gambling person and have been trying to find a good casino for a long time! If someone tells me where to find him, I will be very grateful!
"Eat-and-run Toji-no" is a λ¨Ήν specialised platform that provides consumers with a reliable and detailed guidance to private Toto and casino sites.
Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more