Jump to content

Randoms Numbers


Recommended Posts

  • 1 year later...
  • MVP 2021

I don't know if Stein Yair is still around and participating in this forum, but I just want to say thanks. I had an urgent need for some random number generation and the above post is exactly what I needed.

By the way, Unitronics should consider adding a RND function to the available math functions in VisiLogic.

  • Upvote 1
Link to comment
Share on other sites

  • 1 year later...

Hello kamrca,

 

You must use our software VisiLogic to open .vlp files.  The Jazz/M90 controllers will be programmed in U90, .U90 file extension.

 

Here is a basic overview of the programs:

 

The V570_Random_Number_Generator takes a 32-bit value and multiplies it by 75 (a random number) then divides that value by 65537, and the random number will be the remainder of the division.

 

The Random Number Generator 2 takes a 2.5msec count (generated by the system) and multiplies it by the current second (also a system operand).  Then it reduces the number such that it is a value between 1 and 10 by taking the remainder of the product created before and using the remainder after dividing by 10.

 

Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...