Add button to generate new UUID

This commit is contained in:
Misode
2022-05-12 18:34:55 +02:00
parent 9d0f715a71
commit cd0c37c5dd
3 changed files with 11 additions and 1 deletions

View File

@@ -25,6 +25,14 @@ export function randomSeed() {
return BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))
}
export function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random()*16|0
const v = c == 'x' ? r : (r&0x3|0x8)
return v.toString(16)
})
}
export function newSeed(model: DataModel) {
const seed = Math.floor(Math.random() * (4294967296)) - 2147483648
const dimensions = model.get(new Path(['dimensions']))