From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-22-2021 09:28 AM
Hello,
This is my code of randoming 10 hex values in range of 0x0080 (128) to 0x0F80 (3968).
Sometimes i got value over the range i had selected.
Any ideas how to fix that?
11-22-2021 09:53 AM
Although you hide part of your BD, I can guess that the actual range is 80 to (F80 + 80)=1000.
11-22-2021 09:55 AM
We can't see all of your code, but I suspect you are multiplying by the max instead of the difference between the max and min.
11-22-2021 10:00 AM
Please don't show pictures of code, particularly when we can't clearly see everything and it is difficult to read.
This is a simple Math problem. LabVIEW provides you with a U(0,1) Random number generator. You want something that generates integers (an important specification!) in the range of 128 to 3968 (do you want it to include both 128 and 3968, neither, or just one of them? It matters for the next step).
Your Math Problem -- transform a Random Dbl Number in the range [0, 1) (the notation means it can contain 0, but cannot contain 1) into a (uniform) integer distribution in the range [128, 3968] (assuming you want to include both end-points). Express these values as Hex and you are done.
You should be able to do this on your own with pencil and paper, and then transform this to LabVIEW code. When going from Floats to Integers, think about how you want to round the values.
Bob Schor
11-22-2021 10:31 AM
See if you have got this function on your Numeric palette, makes life easy for you.
11-22-2021 04:09 PM