On Fri, May 2, 2014 at 9:43 AM, Kenta Takagaki <notifications@github.com>wrote:

> In math/src/main/scala/breeze/linalg/constructors/random.scala:
>
> > @@ -0,0 +1,149 @@
> > +package breeze.linalg
> > +
> > +import breeze.generic.UFunc
> > +import breeze.stats.distributions.Rand
> > +
> > +/**Gives a random Double.
> > +  * +  randomDouble()... returns a random double, in [0, 1]
>
> I pretty urgently need the randomInt type constructor, for now I put it
> in my own codebase. Have you decided that it's overkill for breeze? I
> could put it in the DV/DM objects (although it would be a bit of clutter)
> or somewhere in breeze.stats.distributions as well...
>


Sorry, didn't realize the urgency.

So the way this can currently be done is:

```
scala> import breeze.linalg._
import breeze.linalg._

scala> import breeze.stats.distributions._
import breeze.stats.distributions._

scala> DenseMatrix.rand(10, 12, Rand.randInt(32))
res0: breeze.linalg.DenseMatrix[Int] =
12  19  21  20  29  3   2   15  24  8   3   15
21  0   27  3   15  10  22  20  18  11  21  18
13  17  26  5   24  23  5   25  5   13  11  16
11  23  18  11  11  27  19  20  20  25  5   1
12  29  8   25  9   18  26  27  15  8   11  23
12  29  4   24  19  21  0   21  6   8   19  31
11  10  20  7   5   2   30  15  5   13  7   5
3   30  9   22  29  15  24  9   28  24  27  12
8   27  3   16  22  24  5   17  26  6   1   23
2   22  26  23  3   24  31  23  3   18  29  12
```

I would rather keep constructor methods on the objects themselves. It feels
more Scala-y, especially in light of the fact that Breeze supports a lot of
different kinds of vectors/matrices (and will support more). What do you
think?

-- David


>  —
> Reply to this email directly or view it on GitHub<https://github.com/scalanlp/breeze/pull/237/files#r12236728>
> .
>