Merge branch 'people' of ssh://halbi.ddnss.de:2122/media/raid/repositories/pollux into people
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns true with a given percentage.
|
||||||
|
*
|
||||||
|
* @param int $prob Probability for true in percent.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function rand_bool($prob = 50) {
|
||||||
|
if ($prob < 0 or $prob > 100) {
|
||||||
|
throw new InvalidArgumentException('The value for the probability '.
|
||||||
|
' must be in a range from 0 to 100.');
|
||||||
|
} else if (!is_int($prob)) {
|
||||||
|
throw new InvalidArgumentException('rand_bool only accepts integers.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = rand(1, 100);
|
||||||
|
|
||||||
|
return $rand <= $prob;
|
||||||
|
}
|
||||||
@@ -19,6 +19,9 @@
|
|||||||
"phpunit/phpunit": "^7.0"
|
"phpunit/phpunit": "^7.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"app/Http/helpers.php"
|
||||||
|
],
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"database/seeds",
|
"database/seeds",
|
||||||
"database/factories"
|
"database/factories"
|
||||||
|
|||||||
Reference in New Issue
Block a user