LabVIEW

cancel
Showing results for
Did you mean:

Re: VI that calculates sum of random numbers

Well, there is also data queue ptbypt. These solutions all suffer from the fact that with each insertion all queued elements need to be moved in memory (or the compiler needs to track the rotation in some other way or use some extra scratch memory). Much more effort compared to just blindly overwriting the oldest element as I did, operating fully in-place. 😄

Message 11 of 16
(784 Views)

Re: VI that calculates sum of random numbers

@RTSLVU wrote:

I strongly believe that shift registers resized to more than one left node should not be taught. I never use them.

In any case, these indicators probably belong after the loop, not inside. 😉

While we are doing silly code, here's another (probably) bad idea. 😄

Message 12 of 16
(779 Views)

Re: VI that calculates sum of random numbers

@altenbach wrote:

@RTSLVU wrote:

I strongly believe that shift registers resized to more than one left node should not be taught. I never use them.

In any case, these indicators probably belong after the loop, not inside. 😉

While we are doing silly code, here's another (probably) bad idea. 😄

I like your first idea better with the array replacement, I assume this is the same as the array subset idea expressed earlier. Surprised at the nitpicking you are getting. If you really want to nitpick, for a random number between 0-99, the max iterations you can do is about 43 million before you overflow the i32 sum (2^31/50). Future proof and change to an i64.

mcduff

Message 13 of 16
(774 Views)

Re: VI that calculates sum of random numbers

Yes, I'd definitely go with my first suggestion and I even mentioned the potential need for I64. We would gain yet another bit going to U64. 😄

(I would probably add a final rotation to ensure the five elements are in sequential order)

Message 14 of 16
(767 Views)

Re: VI that calculates sum of random numbers

can you send this?

Message 15 of 16
(445 Views)

Re: VI that calculates sum of random numbers

Wrongly Posted

----------------------------------------------------------------------------------------------------------------