RandomIntegerVariable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
/**
3
 * NextFlow (http://github.com/nextflow)
4
 *
5
 * @link http://github.com/nextflow/nextflow-php for the canonical source repository
6
 * @copyright Copyright (c) 2014-2016 NextFlow (http://github.com/nextflow)
7
 * @license https://raw.github.com/nextflow/nextflow-php/master/LICENSE MIT
8
 */
9
10
namespace NextFlow\Math\Variable;
11
12
use NextFlow\Php\Variable\IntegerVariable;
13
14
/**
15
 * A variable that holds a random integer variable.
16
 */
17
final class RandomIntegerVariable extends IntegerVariable
18
{
19
    /**
20
     * Initializes a new instance of this class.
21
     *
22
     * @param int $min The minimum value.
23
     * @param int $max The maximum value.
24
     */
25
    public function __construct($min = 0, $max = PHP_INT_MAX)
26
    {
27
        $value = rand($min, $max);
28
29
        parent::__construct($value);
30
    }
31
}
32