Skip to content

Conversation

@vks
Copy link
Collaborator

@vks vks commented Jul 30, 2018

No description provided.

Copy link
Member

@dhardy dhardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs some kind of value-stability test.


#[test]
fn test_new() {
for &(min, max, mode) in &[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test does very little...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just tests that the asserts are implemented correctly. I ported the test from statrs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're just copying from statrs. I wondered. Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean this test specifically or the distribution in general?

let norm = Triangular::new(0., 1., 0.5);
let mut rng = ::test::rng(1);
for _ in 0..1000 {
norm.sample(&mut rng);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't do much. It could at least test the mean.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. This is the status quo of most distribution tests in Rand though.

In principle we should use histograms and test against the PDF. (I plan to work on that in the midterm, probably after implementing PDFs for #290 and by generalizing tests/uniformity.rs.)

@dhardy
Copy link
Member

dhardy commented Aug 4, 2018

According to the decision in #290 we can go ahead with merging these distributions. I think the main thing missing is extra testing, but that is #357, so I can go ahead and merge if you're not planning any changes now @vks?

@vks
Copy link
Collaborator Author

vks commented Aug 4, 2018

Yes, I think it can be merged. The tests can be added later and are needed for the existing distributions as well. I think only concern is that we might not want to expose new distributions for 0.6 and rather move them to a rand_stat crate. But we can decide this later (any time before the release).

@dhardy dhardy merged commit 3b890dc into rust-random:master Aug 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants