09-25-2014 12:48 PM
Try feeding xmin = xmax to the Uniform Random.vi random number generator.
You'll get an array of NaN, while you would expect a constant array of value xmin.
Error -20069 returned by the VI has the following description in "Explain Error..."
Analysis: The number of samples must be greater than or equal to four.
(my emphasis)
Tested in LV 2013 SP1 W7 64bits
09-25-2014 12:54 PM
Makes sense to me. It probably creates an array of random numbers which is must then scale over your X range. Since your X-range is zero (1 to 1), you are probably getting a divide by zero error thus giving the NaN.
I agree with you that it seems like all the results should be 1. But this is such a corner case of this function, I don't see any real world case where you'd use it like this.
09-25-2014 12:58 PM
I did use a corner case. I did not know that they were not recommended in LV...
09-25-2014 01:06 PM
No. A corner case means someone found a way to use a function that the original designer never would have figured somebody would try to use it in that way.
Why would anyone decide to create a random distribution where the entire array consists of a single value? I could use Initialize Array and get the same result.
The original designer actually did forsee the possibility that the inputs for MIn and Max would be the same, considered that to be an Error in trying to use the function, and thus output the error code.
09-25-2014 01:11 PM - edited 09-25-2014 01:16 PM
So we have two bugs:
I agree that both should be documented and fixed. I'll test in 2014.....
btw, what is the exact name of the function you are using. I don't see it?
09-25-2014 01:27 PM
Black on Blue: Uniform Random.vi
It is found here:
Continuous Random.vi is actually a Polymorphic VI, one version of it being the uniform distribution.
09-25-2014 01:28 PM
altenbach wrote:
- The output is NaN if the range is zero. A perfectly valid correct and unique answer exists (all values =1). That should be the result.
- The error message talks about the number of samples, which is not the problem here (128>=4 :D)
1. It is part of the Continuous Random VI which is found in the Mathematics->Probability & Statistics->Probability palette.
2. The function just puts out an error code, no description. The ring inside of the subVI that does this error check states "Invalid Math Domain" (-20069). When doing a lookup for the error (Help->Explain Error), then you get the weird "samples must be greater than 4" in the explaination.
The problem could be fixed by changing the Uniform Inverse CDF.VI to compare to >=0 instead of >0.
09-25-2014 01:33 PM - edited 09-25-2014 01:35 PM
OK, found it in vi.lib. Yes, I was actually just suggesting the same solution:
Of course it needs to be verified with all other potential callers to make sure there are no other side effects.
09-25-2014 03:45 PM
@altenbach wrote:
OK, found it in vi.lib. Yes, I was actually just suggesting the same solution:
If only we had the power to make CARs, then we wouldn't need NI at all. Bug discovery, bug explaination, bug fix, in under an hour.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-06-2016 02:02 PM
In 2015, the CDF VI is not called and a simple rescaling is performed, therefore the NaN output is resolved.
However, if you provide xmin = xmax, LabVIEW stil throws error -20069 and returns an empty array.
This is not the expected behavior. Please fix.