Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Fixes (Python3) #44

Open
wants to merge 4 commits into
base: python3_port
Choose a base branch
from

Conversation

malvidin
Copy link

Addresses #42 , and it also fixes Int() to return floor of value and fixes Fix() to return the rounded value.

Because of differences between how Python versions implement random.seed(), the first 10 values generated by Rnd are returned from a list before using the Python random() function, unless Randomize is called.

@malvidin
Copy link
Author

malvidin commented Jul 26, 2022

Implements the Visual Basic VB Math Random Functions. Still need to validate the following, which worked in a separate Python class before moving to this project:

  • 1. Randomize without argument generates a new seed in the context using the current time.
  • 2. Randomize with argument generates a new seed in the context.
  • 3. Rnd with a negative argument generates the next random number using the argument as the seed.
  • 4. Rnd with a zero argument generates the previous random number.
  • 6. Rnd with a positive, or without argument, generates the next random number and generates a new seed.

https://github.com/microsoft/referencesource/blob/master/Microsoft.VisualBasic/runtime/msvbalib/Math.vb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant