Fill a byte buffer with random values.
Numeric.random.byte(length, generator)Fills a byte buffer with uniform random values.
- Parameters:
length: Number of bytes to generategenerator: Generator supplying uniform samples
- Returns: Buffer of random byte values
- NumPy: Equivalent to
Generator.bytes.
import Numeric from '@neabyte/numerix'
const bytes = Numeric.random.byte(4, Numeric.random.seed(42))
console.log(Array.from(bytes))
// [0,169,28,217]import Numeric from '@neabyte/numerix'
const bytes = Numeric.random.byte(1, Numeric.random.seed(42))
console.log(Array.from(bytes))
// [0]import Numeric from '@neabyte/numerix'
const bytes = Numeric.random.byte(0, Numeric.random.seed(42))
console.log(Array.from(bytes))
// []import Numeric from '@neabyte/numerix'
const bytes = Numeric.random.byte(4)
console.log(bytes.length)
// 4