samedi 27 juin 2015

How to generate 2D array from a set of string in rails?

I need to generate 2D array in rails from a set of given strings. For example:

days =[ "Monday",
     "Tuesday",
     "Wednesday",
  ]

Now I want to create a 2D array and the data in this array will be fill by from days string in random manner.

Example:

[monday, tuesday, wednesday],
[tuesday, wednesday, monday]
...

and so on depends on given dimensions

How to do it?

Aucun commentaire:

Enregistrer un commentaire