Skip to content

Commit

Permalink
Merge pull request #25 from ltnscp9028/refactor/no-let
Browse files Browse the repository at this point in the history
Refactor: no let RandomGenerator with reduce x2 faster
  • Loading branch information
samchon authored Apr 22, 2022
2 parents 8f90c36 + 4870c68 commit abf3866
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/internal/RandomGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ export namespace RandomGenerator

export function string(length: number = randint(3, 10)): string
{
return [...new Array(length)]
.map(() => CHARACTERS[randint(0, CHARACTERS.length - 1)])
.join("");
return [...new Array(length)].reduce((prev)=>prev+CHARACTERS[randint(0, CHARACTERS.length - 1)],"");
}

export function number(min: number = 0, max: number = 100): number
Expand Down

0 comments on commit abf3866

Please sign in to comment.