Skip to content

minenode/wasm-java-random

Repository files navigation

wasm-java-random

A full implentation of Java's java.util.Random class for JavaScript, written in WebAssembly using AssemblyScript.

yarn add @minenode/wasm-java-random

In theory, this is portable across Node.JS and modern browsers. Though this may not be the case due to 64-bit integers not yet being supported on browsers.

In Node.JS, you must use the --experimental-wasm-bigint (Node >= 13) flag when running Node to enable the use of bigints for representing 64-bit results. Without this flag enabled, you will get this error when calling the Random class constructor:

Uncaught TypeError: wasm function signature contains illegal type

See index.d.ts for the exported API.

TODO: Modify Random#nextInt to read data from WASM memory for performance.


Copyright © MineNode. Licensed under the MIT License.

About

java.util.Random implemented in WebAssembly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published