[challenge] Random string generator 06-01-2015, 03:08 AM
#1
I don't know why, the only challenges I can come up with have something to do with generation..
Anyway, the challenge here is to generate a handful of random strings, separated by a newline (\n).
Rules:
-As usual, no bullshit imports
-Maximum 2 loops can be used
-Refactor to be as small as possible
-If the final product is 3 lines or under, I'll give you 10 NSP (it's pretty easy)
Sample output:
Anyway, the challenge here is to generate a handful of random strings, separated by a newline (\n).
Rules:
-As usual, no bullshit imports
-Maximum 2 loops can be used
-Refactor to be as small as possible
-If the final product is 3 lines or under, I'll give you 10 NSP (it's pretty easy)
Sample output:
Code:
AA7XM1Dy
RiC6Q
IQKkcR
XQI
CdFU
hrvz
aK7z7o
gqC
6m9
o0SAq
3zi7
Rf5ZhpL
95
Y
lW
MAUoqfWSpoiler: My Solution (Ruby):
2 lines, told you it was easy.
Code:
chars = [("a".."z").to_a,("A".."Z").to_a,("0".."9").to_a].flatten
16.times { (1..9).to_a.sample.times { print chars.sample }; puts "\n" }It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.

















![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

