- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- Lottery Generator

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- « Previous
- Next »

Re: Lottery Generator

01-04-2018 11:04 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I meant using the rifle VI from the palette.

Re: Lottery Generator

01-05-2018 11:07 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Wow. Some amazing insights in here.

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

Re: Lottery Generator

01-05-2018 11:50 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@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

Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel .............. Great paleotechnics YouTubeChannel... talk about stone knives and bears skins! Check it out!

Re: Lottery Generator

01-05-2018 12:19 PM - edited 01-05-2018 01:23 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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.

- « Previous
- Next »