On Wed, Aug 18, 2010 at 2:42 PM, Jean-Julien Fleck <jeanjulien.fleck / gmail.com> wrote: >> how can i set the passenger for each vehicle? like for example >> i input vehicles number: 5 >> how can set the passenger of vehicle 1 which is it only allow 1 >> passenger > > I think you misread the problem: nobody says that the first vehicle > have to have 1 passenger. All it says is that if you take a pool of > 100 vehicles, 20 of them will have only 1 passenger, 30 2 passengers, > 10 3 passengers, 10 4 passengers and the 30 remaining will be buses of > 40 passengers. Bruce, Consider a simpler case w/ pencil, paper, and a coin. Assume that 50% of vehicles have 2 passengers and 50% have 3. How would you do it? Maybe something like: Flip coin If result is heads then vehicle will have 2 passengers Otherwise, if result is tails vehicle will have 3 passengers Otherwise wow, edge!? Let's make that more code-like: result = rand(2) if result == 0 puts "2" else puts "3" end