@leetcoderoulette/roulette
Version:
https://leetcoderoulette.com roulette library
50 lines • 1.34 kB
TypeScript
/**
* Roulette options.
*/
interface RouletteOptions {
/**
* Boolean value that indicates if a value should be removed from the set when it is retrieved.
* @default true
*/
popWhenGettingObject: boolean;
/**
* Boolean value that indicates if the set can be reset after initialization.
* @default true
*/
enableSetReset: boolean;
}
/**
* Roulette class to get a random values from a set of values.
*/
export default class Roulette<T> {
private static NO_VALUES_ERROR;
private set;
private options;
/**
* Creates new Roulette instance with initial set.
* @param values Initial values array.
* @param options Roulette options.
*/
constructor(values: T[], options?: Partial<RouletteOptions>);
/**
* Gets a random value from set and deletes it.
* @returns A random value from the set.
*/
pop(): T;
/**
* Gets the number of values left in the set.
* @returns Size of the set.
*/
get size(): number;
/**
* Gets array of available problems from problemset.
* @returns Array of problems in the problemset.
*/
get values(): T[];
/**
* Sets the set to the provided objects.
*/
set values(values: T[]);
}
export { RouletteOptions };
//# sourceMappingURL=index.d.ts.map