From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lottery Generator

Solved!
Go to solution

I meant using the rifle VI from the palette. 😉

0 Kudos
Message 21 of 24
(799 Views)

Wow. Some amazing insights in here. 

 

Can I ask why the scale by power of two is used rather than multiply?

0 Kudos
Message 22 of 24
(775 Views)

@StevenD wrote:

Wow. Some amazing insights in here. 

 

Can I ask why the scale by power of two is used rather than multiply?


I will wait to hear from Christian and learn as well but I can observe that a scale by a power of two in binary is simply an arithmetic shift left.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 23 of 24
(767 Views)

StevenD wrote:

Can I ask why the scale by power of two is used rather than multiply?


Multiply is probably a better choice here, because the price can change by a random amount. A multiplication/division by integer powers of two corresponds to an arithmetic shift (not logical shift, important difference when the input is negative) for integers. Even for floating point numbers, only a subset of bits need to be touched, but I doubt it would make a difference on a modern processor (but would be of great help when using paper& pencil :)).

 

So, yes we should use multiplication here. Shifts/powers of two should be used where it is more natural, e.g. if you would implement the cooley-tuckey fft or a binary search. Sorry about that.

Message 24 of 24
(759 Views)