Draw samples from a triangular distribution.
Numeric.random.triangular(first, method, right, count, generator)Produces variates between the bounds and the mode.
- Parameters:
first: Lower bound of the distributionmethod: Most likely value of the distributionright: Upper bound of the distributioncount: Number of samples to draw when givengenerator: Generator supplying uniform samples
- Returns: Single sample or array of samples
- NumPy: Equivalent to
Generator.triangular.
import Numeric from '@neabyte/numerix'
const values = Numeric.random.triangular(0, 1, 2, 3, Numeric.random.seed(42))
console.log(values)
// [0.07271715810629219,1.1757572898460358,0.47107767254406174]import Numeric from '@neabyte/numerix'
const value = Numeric.random.triangular(0, 1, 2, undefined, Numeric.random.seed(42))
console.log(value)
// 0.07271715810629219import Numeric from '@neabyte/numerix'
const values = Numeric.random.triangular(10, 12, 14, 3, Numeric.random.seed(42))
console.log(values)
// [10.145434316212585,12.351514579692072,10.942155345088123]import Numeric from '@neabyte/numerix'
const values = Numeric.random.triangular(0, 1, 2, 3)
console.log(values.length)
// 3