Implementation of the function bga_rand

Game development with Board Game Arena Studio
Post Reply
User avatar
bidulpik
Posts: 79
Joined: 17 November 2011, 09:02

Implementation of the function bga_rand

Post by bidulpik »

Howdy,
can we have the implementation of the function
bga_rand please
it is to proove customers that our code is correct according to the randomizer.
I've seen this interesting article on the forum :
viewtopic.php?t=18290
And this conribution in the group :
https://boardgamearena.com/group?id=1224884
(title = ❤ There is no problem with dice randomizer ❤ )

I'll look for social science article about the feeling of wrong randomizer to explain to customer that dont beleive me for the game I develop for BGA, the backgammon.

Best regards
User avatar
ufm
Posts: 2039
Joined: 06 January 2017, 08:38

Re: Implementation of the function bga_rand

Post by ufm »

I'm currently maintaining Yahtzee. I stopped bothering as they can't prove anything they say. Imo they just need something or someone to blame.
User avatar
bennygui
Posts: 74
Joined: 03 April 2020, 20:08

Re: Implementation of the function bga_rand

Post by bennygui »

Search bga_rand on this page: https://en.doc.boardgamearena.com/Main_ ... e.game.php

It says: "As of now, bga_rand is based on the PHP function "random_int", which ensures a cryptographic level of randomness."

So now you have to check how random_int is implemented in PHP!
User avatar
RicardoRix
Posts: 2540
Joined: 29 April 2012, 23:43

Re: Implementation of the function bga_rand

Post by RicardoRix »

it's like a rabbit hole inside a rabbit hole.
I wonder if Alice will find the right potion.
User avatar
CitadelUK
Posts: 7
Joined: 05 April 2018, 22:11

Re: Implementation of the function bga_rand

Post by CitadelUK »

bennygui wrote: 16 May 2024, 13:48 Search bga_rand on this page: https://en.doc.boardgamearena.com/Main_ ... e.game.php

It says: "As of now, bga_rand is based on the PHP function "random_int", which ensures a cryptographic level of randomness."

So now you have to check how random_int is implemented in PHP!
Feels like this comes up so often that it would help to have a standard answer for this.

Die rolling and card shuffling in BoardGameArena use cryptographically secure randomisers that are more random than physically rolling dice or shuffling cards.

https://en.doc.boardgamearena.com/Main_ ... d_bga_rand "As of now, bga_rand is based on the PHP function "random_int", which ensures a cryptographic level of randomness."
https://www.php.net/manual/en/function.random-int.php "A cryptographically secure, uniformly selected integer from the closed interval [min, max]."
https://man7.org/linux/man-pages/man2/getrandom.2.html "The random source is limited based on the entropy that can be obtained from environmental noise."
https://en.wikipedia.org/wiki/Entropy_(computing) "The Linux kernel generates entropy from keyboard timings, mouse movements, and integrated drive electronics (IDE) timings and makes the random character data available to other operating system processes through the special files /dev/random and /dev/urandom."
User avatar
GTSchemer
Posts: 1130
Joined: 09 August 2013, 03:26

Re: Implementation of the function bga_rand

Post by GTSchemer »

It's very easy to get a developer account, and many users on this forum are developers, myself included.

It is trivial to run bga_rand() many times, take the output, and put it into a curve fitter. I believe this has been done before (maybe multiple times), and when done, gives a very strong confirmation that the number distribution is as expected over a large sample.

Obviously taking a very small sample will not always be evenly distributed, just like you can flip a coin and see heads 4 times in a row.


Anyone unwilling to do (or consider) this basic mathematical test is likely not arguing in good faith.
User avatar
JimBut
Posts: 60
Joined: 03 December 2021, 23:45

Re: Implementation of the function bga_rand

Post by JimBut »

I don't think showing the code would help convince someone that there is a sitewide conspiracy to tailor the randomiser to each specific game.

People tend to be bad at dealing with randomness, even the open source backgammon game GNUBG gets accused of cheating or not being random and you can examine the code base for that.

As an aside I'm loving the new Backgammon implementation bidulpik!
User avatar
Lunalol
Posts: 575
Joined: 09 October 2016, 23:21

Re: Implementation of the function bga_rand

Post by Lunalol »

Then, one day, a student who had been left to sweep up after a particularly unsuccessful party found himself reasoning in this way: "If such a machine is a virtual impossibility, it must have finite improbability. So all I have to do, in order to make one, is to work out how exactly improbable it is, feed that figure into the finite improbability generator, give it a fresh cup of really hot tea... and turn it on!" He did this and managed to create the long sought after golden Infinite Improbability generator out of thin air. Unfortunately, shortly after he was awarded the Galactic Institute's Prize for Extreme Cleverness, he was lynched by a rampaging mob of respectable physicists on the ground that he has became the one thing they couldn't stand most of all: "a smart arse".
From https://hitchhikers.fandom.com/wiki/Inf ... lity_Drive

Conclusion, in the BGA premises, there is a fresh cup of really hot tea whose Brownian motion is used by the entropy generator of the Linux kernel.
Post Reply

Return to “Developers”