Fasguy / MinecraftToolbox

A WebApp that provides tools for mixing up your Minecraft gameplay
https://fasguy.net/minecraft_toolbox
MIT License
8 stars 3 forks source link

More efficient seed handling #5

Open Fasguy opened 2 years ago

Fasguy commented 2 years ago

JavaScript provides 53 integer-safe bits for numbers, which can be fully utilized with a custom number input. A string input however only provides a 32 bit hash with the current hashing implementation. Utilizing all 53 bits reduces the chance of collisions. It may be worth looking into cyrb53 (https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js) for this.

This will be a big breaking change and will cause old string-based seeds to no longer produce the same output


Original title: Find solution for the seed input to support the full number range

Original Description: ~~JavaScript provides 53 bits of integer-safety, this is not enough, if i want to emulate how Minecraft handles seed inputs. A point of interest might be BigInt, but i don't think that this is suitable for inputting seeds.~~