mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-09 22:02:45 +08:00
23 lines
464 B
TypeScript
23 lines
464 B
TypeScript
import { RandomManager } from "./RandomManager";
|
|
|
|
/** 伪随机 */
|
|
export class SeedRandom {
|
|
private rm: RandomManager;
|
|
private sr: any;
|
|
|
|
get random(): RandomManager {
|
|
return this.rm;
|
|
}
|
|
|
|
constructor(seed: string) {
|
|
//@ts-ignore
|
|
this.sr = new Math.seedrandom(seed);
|
|
this.rm = new RandomManager();
|
|
this.rm.setRandom(this.sr);
|
|
}
|
|
|
|
destroy() {
|
|
this.rm = null!;
|
|
this.sr = null!;
|
|
}
|
|
} |