mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 23:36:15 -04:00
refactor: improved shuffle function (now using Durstenfeld shuffle)
This commit is contained in:
parent
436d960603
commit
1ebfe83d20
4 changed files with 23 additions and 8 deletions
|
@ -38,7 +38,7 @@ path: '/token-generator'
|
|||
import {Component, Watch} from 'nuxt-property-decorator'
|
||||
import Tool from '~/components/Tool.vue'
|
||||
import {CopyableMixin} from '~/mixins/copyable.mixin'
|
||||
import {shuffle} from '~/utils/string'
|
||||
import {shuffleString} from '~/utils/random'
|
||||
|
||||
const lowercase = 'abcdefghijklmopqrstuvwxyz'
|
||||
const uppercase = 'ABCDEFGHIJKLMOPQRSTUVWXYZ'
|
||||
|
@ -78,7 +78,7 @@ export default class TokenGenerator extends Tool {
|
|||
result += specials
|
||||
}
|
||||
|
||||
this.token = shuffle(result.repeat(this.config.length)).substring(0, this.config.length)
|
||||
this.token = shuffleString(result.repeat(this.config.length)).substring(0, this.config.length)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue