Skip to content

Instantly share code, notes, and snippets.

@tal
Created March 19, 2010 15:03
Show Gist options
  • Select an option

  • Save tal/337575 to your computer and use it in GitHub Desktop.

Select an option

Save tal/337575 to your computer and use it in GitHub Desktop.
class Sequel::Model
def_dataset_method :random do |*args|
range, size = *args
size ||= 1; raise ArgumentError, 'need to specify a range as the first argument' unless range
limit(size,rand(range))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment