-
Notifications
You must be signed in to change notification settings - Fork 226
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
Proposal: Add functions to generate random values #390
Comments
We can do the first one already - https://docs.jsonata.org/numeric-functions#random |
I looked at some of the javascript implementations for uuid and worked out this expression that generates a v4 UUID:
What would have made this simpler is if there were bitwise operators built-in to Jsonata, but that should be a separate request, I suppose. |
Though issue with random solved I strongly believe the |
HI does any one have an example where would adjust above not to be HEX, I am actually just looking for a random set of characters? update: I just made something like
|
It seems there isn't a separate issue related to UUID() and it seems like there is consensus. I need it inside a map, to generate a new one as I iterate through an array. |
It would be nice if JSONata had the ability to generate random values. Consider the following two cases:
Generate a random number between 0 and 1 (similar toMath.random()
in JavaScript.)uuid
as a dependency.)The text was updated successfully, but these errors were encountered: