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

Math.Random() only uses the max value #13501

Closed
TheConenter opened this issue Oct 26, 2023 · 1 comment
Closed

Math.Random() only uses the max value #13501

TheConenter opened this issue Oct 26, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@TheConenter
Copy link

TheConenter commented Oct 26, 2023

Describe your problem here.

I've been trying to code a little randomized event but when I try using math.random(min, max); it only gives me its max number

The codeline :

function onStepHit()
next_block = math.random(1, 3);
end

The value "next_block" only returns as whatever the max for math.random is, what am I doing wrong?

More information to help :

Psych Version : 0.6.2 (Modified only on the stuff listed in the "Did you edit anything in this build?" part)

I also tried changing it to getRandomInt(min, max) but that one had the same issue

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

healthloss by misses is higher, winning icons are a thing, and discord rich pressence is now themed on the mod.

@TheConenter TheConenter added the help wanted Extra attention is needed label Oct 26, 2023
@TheConenter TheConenter changed the title Math.Random() only uses the max value I give it Math.Random() only uses the max value Oct 26, 2023
@TheConenter
Copy link
Author

Update, nvm I found a fix, just needed to add math.randomseed(os.time())

I'll just close the issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant