Completed
Pull Request — dev (#23)
by Jordan
02:47
created

Distribution   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 23
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
random() 0 1 ?
A randomSample() 0 10 2
rangeRandom() 0 1 ?
1
<?php
2
3
namespace Samsara\Fermat\Provider\Distribution\Base;
4
5
use Samsara\Fermat\Types\NumberCollection;
6
use Samsara\Fermat\Values\ImmutableNumber;
7
8
abstract class Distribution
9
{
10
11
    abstract public function random(): ImmutableNumber;
12
13
    /**
14
     * @param int $sampleSize
15
     * @return NumberCollection
16
     */
17
    public function randomSample(int $sampleSize = 10): NumberCollection
18
    {
19
        $sample = new NumberCollection();
20
21
        for ($i = 1;$i < $sampleSize;$i++) {
22
            $sample->push($this->random());
23
        }
24
25
        return $sample;
26
    }
27
28
     abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableNumber;
29
30
}