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

scripts.lib xmur3 Update description and change example #454

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/scripting/scripts.lib/xmur3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: .xmur3()
---

A function that takes a string and turns it into a random number based on the xmur3 algorithm.
A function that takes a string and returns a function that creates a numerical value based on the xmur3 algorithm. The returned function can be called multiple times to produce multiple seeds. Intended to be used with [JSF](https://wiki.hackmud.com/scripting/scripts.lib/JSF), [LCG](https://wiki.hackmud.com/scripting/scripts.lib/LCG), [mulberry32](https://wiki.hackmud.com/scripting/scripts.lib/mulberry32), [sfc32](https://wiki.hackmud.com/scripting/scripts.lib/sfc32), and [xoshiro128ss](https://wiki.hackmud.com/scripting/scripts.lib/xoshiro128ss).

## Syntax

Expand All @@ -18,16 +18,16 @@ The string that will serve as the seed for RNG.

### Return

Returns a number.
Returns a function that generates numerical seeds.

## Example

```js
function(context, args) {
const l = #fs.scripts.lib();
const my_string = "i_am_a_string_to_be_hashed";
const rng = l.xmur3(my_string);
const seed = l.xmur3(my_string);

return rng;
return seed();
}
```
Loading