Last active
May 20, 2021 08:13
-
-
Save damondouglas/30191a38f5c3daa482fc to your computer and use it in GitHub Desktop.
Generate Random String based on length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
String _randomString(int length) { | |
var rand = new Random(); | |
var codeUnits = new List.generate( | |
length, | |
(index){ | |
return rand.nextInt(33)+89; | |
} | |
); | |
return new String.fromCharCodes(codeUnits); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!