qtest
C
code posted
created at 05 Sep 11:25, updated at 05 Sep 17:02
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 |
class MainController < ApplicationController def index @range = (0..params[:amount].to_i - 1).to_a @array = @range.collect { rand(params[:min].to_i..params[:max].to_i) } @sorted = @array.sort @unique = @sorted.uniq @frequency = @unique.collect { |item| @sorted.count(item) } @collected_frequency = (1..@frequency.length).collect { |i| @frequency.first(i).inject(:+) } end end |
414 Bytes in 2 ms with coderay