Sinisterly
[challenge] Random string generator - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: [challenge] Random string generator (/Thread-challenge-Random-string-generator)



[challenge] Random string generator - Inori - 06-01-2015

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:
Code:
AA7XM1Dy RiC6Q IQKkcR XQI CdFU hrvz aK7z7o gqC 6m9 o0SAq 3zi7 Rf5ZhpL 95 Y lW MAUoqfW

Spoiler: 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" }



RE: [challenge] Random string generator - Crypt - 06-01-2015

You never said no bash commands. Fuck your challenge nigga.
Code:
od --string /dev/urandom

Where's my 10 NSP at?


RE: [challenge] Random string generator - Inori - 06-01-2015

(06-01-2015, 04:51 AM)nothing.nobody Wrote: You never said no bash commands.

that's just common sense.. It's a programming challenge, not a "let's dick around with our terminal" session.

In addition, this breaks the rules. Correct me if I'm wrong, but calling /dev/urandom is importing something, thus, breaking the rule of "no bullshit imports"


RE: [challenge] Random string generator - Crypt - 06-01-2015

(06-01-2015, 04:52 AM)Touka Wrote: that's just common sense.. It's a programming challenge, not a "let's dick around with our terminal" session.
(06-01-2015, 03:08 AM)Touka Wrote: Anyway, the challenge here is to generate a handful of random strings, separated by a newline (\n).

That command does exactly what the challenge states to do, does it not? If not, I can just make it into a program instead.

lol.sh:
Code:
od --string /dev/urandom