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

[Feature Request] Random #87

Closed
ExerciseBook opened this issue Dec 18, 2019 · 4 comments
Closed

[Feature Request] Random #87

ExerciseBook opened this issue Dec 18, 2019 · 4 comments
Labels
syntax Suggestions to improve the syntax

Comments

@ExerciseBook
Copy link
Contributor

In https://github.com/LingDong-/wenyan-lang/blob/master/examples/divination.wy , I defined a random number generator function by JavaScript.
Maybe we can change it into an individual keyword.

@LingDong-
Copy link
Member

Yup I'm definitely going to fix that. As explained in this and this issue, Randomness among other math functions most likely be implemented as standard library function calls instead of making its way into the syntax.
Btw, thanks again for your example, I myself couldn't have implemented it better ;)

@ExerciseBook
Copy link
Contributor Author

OK, I see. Thx.

@antfu
Copy link
Member

antfu commented Jan 29, 2020

@antfu antfu closed this as completed Jan 29, 2020
@hiking93
Copy link

Is there any way to set current timestamp as the random seed? Both divination.wy and
tree2.wy
set a constant number as the seed, so they generate the exact same results every time we run.

In 西曆法.wy we currently have no functions that return current time in milli-seconds. May need to create one?

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

No branches or pull requests

4 participants