mirror of
https://github.com/fluencelabs/assemblyscript-dice
synced 2025-04-25 16:12:14 +00:00
fix random
This commit is contained in:
parent
deeecf2290
commit
2b40ad2d59
@ -16,6 +16,10 @@ export class GameManager {
|
||||
playerBalance: Map<u64, u64> = new Map<u64, u64>();
|
||||
encoder: JSONEncoder = new JSONEncoder();
|
||||
|
||||
constructor() {
|
||||
NativeMath.seedRandom(SEED);
|
||||
}
|
||||
|
||||
join(): string {
|
||||
// delete the oldest player, if maximum players reach
|
||||
if (this.playerIds.length >= PLAYERS_MAX_COUNT) {
|
||||
@ -53,7 +57,7 @@ export class GameManager {
|
||||
return error.serialize();
|
||||
}
|
||||
|
||||
let outcome = ((Math.random() * 10000000) % DICE_LINE_COUNT + 1) as u8;
|
||||
let outcome = ((Math.random() * 1000000) % DICE_LINE_COUNT + 1) as u8;
|
||||
|
||||
let newBalance: u64 = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user