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

PRNG functions #133

Closed
Dregu opened this issue Aug 9, 2021 · 4 comments
Closed

PRNG functions #133

Dregu opened this issue Aug 9, 2021 · 4 comments
Assignees

Comments

@Dregu
Copy link
Collaborator

Dregu commented Aug 9, 2021

I don't know how much sense starting random_index from 0 makes in lua...
random_int crashes when min==max and does crazy stuff when min>max

Anyway adding prng:random() that works as a drop in replacement for math.random() would be neat. I don't know if you already had this in mind.

math.random() with no arguments generates a real number between 0 and 1.
math.random(upper) generates integer numbers between 1 and upper (both inclusive).
math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).

@Malacath-92
Copy link
Contributor

Oh right, how did I not think of that 🤦‍♀️
I'll look into those

@Malacath-92
Copy link
Contributor

@Dregu Do you know what the other pairs are used for or did you just pick them randomly in rando2?

@Dregu
Copy link
Collaborator Author

Dregu commented Aug 10, 2021

did you just pick them randomly in rando2?

As is tradition. Well actually all I know is that some of them only change on level gen, others when you blow up stuff and some on every frame. I tried to pick appropriate ones for the occasion but probably forgot what I was supposed to do halfway.

@Malacath-92
Copy link
Contributor

I looked at some level gen code and all I saw used the first pair, hence I labeled it as such. I guess I'll have to look at more code to figure out at least some of the others.

@Dregu Dregu closed this as completed Sep 6, 2021
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

No branches or pull requests

2 participants