srandmember on sets?

19 views
Skip to first unread message

hau

unread,
Oct 22, 2011, 2:31:29 AM10/22/11
to ohm-...@googlegroups.com
I was wondering how to select a random member of a set using ohm.  For example, I have two models:

class Event < Ohm::Model
  attribute :name
  set :participants, Person
end

class Person < Ohm::Model
  attribute :name
end

an event has a set of participants.  I want to be able to randomly pick one participant.  How should it be done?  Is there a method similar to redis srandmember?  It's important to have some randomness in picking a member from a set.

Thanks for your advice.
Reply all
Reply to author
Forward
0 new messages