LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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. 😄

0 Kudos
Message 11 of 16
(938 Views)

@RTSLVU wrote:

How about something like this?


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. 😄

 

lastFive.png

0 Kudos
Message 12 of 16
(933 Views)

@altenbach wrote:

@RTSLVU wrote:

How about something like this?


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. 😄

 

lastFive.png


 

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. Smiley Very Happy

 

mcduff

0 Kudos
Message 13 of 16
(928 Views)

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)

0 Kudos
Message 14 of 16
(921 Views)

can you send this?

0 Kudos
Message 15 of 16
(599 Views)

Wrongly Posted

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 16 of 16
(572 Views)