-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rand(1:1000) #1135
Comments
Useful, but starts to get kind of opaque if you want to know what |
Not so sure about this. What is the motivation, since the way to otherwise do that with
|
The motivation is that I can't ever recall what randfoo function I need to use and how to call it. I want a single more consistent interface to generating random numbers: |
I like the general idea, but then there is confusion between picking a random index from some distribution and using that to select from a collection, versus using the collection itself as the distribution. But maybe it would be ok given the generally more consistent interface. |
If you're going to use an array as some kind of distribution, you need more information than just an array of numbers to know what it means. For example, is the array a PDF or a CDF? To disambiguate that, you'd want to write |
I've come to the opinion that we should scrap the Matlab-compatible random number interface as the primary interface and do something more consistent like what @dmbates and @johnmyleswhite have done in distributions.jl. We can have Matlab-compatibility and R-compatibility modules that can be imported to make porting code from those two systems easier. But we should encourage a more consistent, better-designed interface as the way to write new code. If it's consistent enough, it will be so easy to learn that even people really deeply entrenched in Matlab or R will pick it up quickly. |
Agreed. When I have some time I've been planning to write up documentation for distributions.jl so that people realize how much is already in there. -- John On Aug 9, 2012, at 12:06 PM, Stefan Karpinski wrote:
|
I'm fine with that. The matlab interface in particular is so simple you can write it on top of anything. Is it possible to have the matlab functions available at the prompt by default, or are there conflicts? |
That's a good question. I'm not sure. It would be nice if there were no collisions, but I still may not want to have the Matlab function available since that would encourage their use instead of discouraging it. |
There aren't conflicts, but why not put all of the Matlab stuff into a module that essentially provides a Matlab compatibility mode? That could be used not just for RNG's, but also for lots of other things like file operations, etc. |
+1 |
I don't know; not all cases are similar. The |
Maybe everyone knows this, but in case not: Matlab has two sets of random number functions. The broader set is in the statistics toolbox: Presumably you're talking mostly about the ones that come with core Matlab. |
Looking back at this, I should point out that we already have a function From what I understand, we're only concerned with the core Matlab names since the other names struck a few of us as pretty ugly. |
I think this is tempting, but it is not a good idea to have a compatibility layer. We can just use a different name, like random instead of rand, and leave rand as is for comfort to matlab users. -viral On 10-Aug-2012, at 3:13 AM, John Myles White [email protected] wrote:
|
@johnmyleswhite Nonsense, |
Done by #2070. |
This should maybe sample from the array of values represented by the range?
The text was updated successfully, but these errors were encountered: