C# Enumerable Repeat
-
How to do this in Java Android Development?
var _pass = new string(
Enumerable.Repeat(_chars, _len)
.Select(s => s[_rnd.Next(s.Length)])
.ToArray());First, learn Java. Second, learn C#. Then translate the one to the other. We are not here to do your work for you. And since you are clearly trying to get by without thinking for yourself - your other questions are clear evidence of that - I for one am not prepared to do any more for you. Pull your finger out, learn your subject(s) and start thinking.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
How to do this in Java Android Development?
var _pass = new string(
Enumerable.Repeat(_chars, _len)
.Select(s => s[_rnd.Next(s.Length)])
.ToArray());The best way to translate this is for you to sit down and work out what this code is currently doing. Once you know what this is doing, it becomes a lot easier to translate it into a different language.
This space for rent
-
How to do this in Java Android Development?
var _pass = new string(
Enumerable.Repeat(_chars, _len)
.Select(s => s[_rnd.Next(s.Length)])
.ToArray());It was always a weird way to do it, certainly took me a minute more time to read than it should. This is particularly offensive since it has a side-effect in code that pretends to be all "pure" and "elegant" and "look at me I'm using enumerables I'm so hip". What it really does is make a string from `_len` random characters from `_chars`, so just implement *that* however makes the most sense. Which in Java is probably this: char[] temp = new char[_len]; for (int i = 0; i < temp.length; i++) temp[i] = _chars[_rnd.nextInt(_chars.length)]; String _pass = String.valueOf(temp);