language-agnosticcode-golfrosetta-stone

Create, sort, and print a list of 100 random ints in the fewest chars of code


What is the least amount of code you can write to create, sort (ascending), and print a list of 100 random positive integers? By least amount of code I mean characters contained in the entire source file, so get to minifying.

I'm interested in seeing the answers using any and all programming languages. Let's try to keep one answer per language, edit the previous to correct or simplify. If you can't edit, comment?


Solution

  • 10 characters in J:

    /:~100?9e9
    

    explanation:

    /:~ sorts an array (technically, applies a lists sorted permutation vector to itself)

    x ? limit returns x random numbers less than limit

    9e9 (9000000000) is a reasonable upper limit expressible in 3 characters. !9 (9 factorial) is smaller, but requires one less character.