06-11-2013 09:30 AM - edited 06-11-2013 09:35 AM
@RavensFan wrote:
So 6.5 would round down to 6. 5.5 would round up to 6. So using regular rounding introduces slightly more biased results there.
i totally did not considered this......easily forgotten, back in core 1
1.5 to 2....and 2.5 to 2, rounding to the nearest even number
06-12-2013 01:49 PM
Hey again, sorry for the delay. Been rather busy I've tampered with the .vi but still no luck so far, I wasn't able to make it work properly. All ideas are welcome!
06-12-2013 02:55 PM
Then attach what you have so far and tell us exactly how it isn't working like you want.
06-13-2013 03:55 AM
Yeah, I forgot to add the .vi, my bad. Blame the insomnia here's the file. I've added a waveform chart as well as a table. But I can't make it distinguish the odds and the even ones, and send the odd number to board #1 and the evens to a board #2.
Bear in mind that my LabVIEW version is 9.0.
Thanks!
06-13-2013 04:29 AM
I don't see 2 tables in your VI. There were also issues discussed about the rounding that you didn't incorporate either. I edited your VI to build a single table containing the values and whether it was even or odd. This is meant as a stepping point for you.
06-13-2013 06:25 AM
There was a discussion on the LAVA forums a few years ago about random integers and rounding.
To get an even distribution from low to high, you add one to the high value, then round downward.
See the example VI in this post. (Originally by Jim Kring from the openg forums. I simply duplicated it for discussion)
http://lavag.org/topic/14981-random-number-integer-numeric-package/#entry90015
An alternative to the quotient and remainder technique would be to AND the random integers with 0x01 and compare the results with 0x01. If TRUE, the number would be ODD.
06-13-2013 06:30 AM
Indeed, I didn't use two tables because I couldn't get the second one working, so I left it out. It's a little more clear now, thanks for the heads up. I'll get to work on it right away.
I hope everyone is learning something from this
06-16-2013 10:48 PM - edited 06-16-2013 11:00 PM
Yet another way of doing odd/even determination... it simply does LSB check using bit shifting... as a great soul once said: Do more with less code in less time!
Plus there are plenty of folks out there like myself who don't like usage of strings so much (just personal preference - and also because using boolean & integers is faster). Attached example doesn't use strings but still gives the same result.
-DP
(Please don't mind the label for boolean in that cluster, I realize that it should say "Even?")