This repository was archived by the owner on Oct 23, 2021. It is now read-only.
-
Couldn't load subscription status.
- Fork 5
sp core library.irandomnumbergenerator
John Nguyen edited this page Apr 22, 2021
·
2 revisions
Home > @microsoft/sp-core-library > IRandomNumberGenerator
This is a ServiceScope contract for generating pseudorandom random numbers.
Signature:
export interface IRandomNumberGeneratorThis interface abstracts the functionality of the system Math.random() API for usage with a ServiceScope. For example, a unit test might replace the default RandomNumberGenerator service with a mock implementation that always returns the same sequence of random numbers, in order to ensure that test failures are always repeatable.
| Method | Description |
|---|---|
| generate() | Returns a pseudorandom number between 0 (inclusive) and 1 (exclusive), following the contract of Math.random(). |