Merge pull request #491 from JustAGenericUsername/main
This commit is contained in:
commit
7d9d0f067c
|
|
@ -0,0 +1,41 @@
|
|||
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
|
||||
var states = ["solid", "liquid", "gas"]
|
||||
var total = 0
|
||||
var elementslist = []
|
||||
for (elementi in elements){
|
||||
elementslist.push(elementi)
|
||||
}
|
||||
function randomIntFromInterval(min, max) { // min and max included
|
||||
return Math.floor(Math.random() * (max - min + 1) + min)
|
||||
}
|
||||
var randomProperty = function (obj) {
|
||||
var keys = Object.keys(obj);
|
||||
return obj[keys[ keys.length* Math.random() << 0]];
|
||||
};
|
||||
for (var i = 1; i <= 10000; i++){
|
||||
var f = Math.random() < 0.2
|
||||
var co = Math.random() < 0.2
|
||||
elements["element_"+i] = {
|
||||
color: "#" + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)],
|
||||
category: "random",
|
||||
behavior: randomProperty(behaviors),
|
||||
state: states[Math.floor(Math.random()*states.length)],
|
||||
reactions: {},
|
||||
density: randomIntFromInterval(1, 10000)
|
||||
}
|
||||
total = i
|
||||
if (f){
|
||||
elements["element_"+i].tempHigh = 20 + randomIntFromInterval(10, 6000)
|
||||
elements["element_"+i].stateHigh = elementslist[Math.floor(Math.random()*elementslist.length)]
|
||||
}
|
||||
if (co){
|
||||
elements["element_"+i].tempLow = 20 - randomIntFromInterval(10, 270)
|
||||
elements["element_"+i].stateLow = elementslist[Math.floor(Math.random()*elementslist.length)]
|
||||
}
|
||||
for (r = 0; r < 10; r++){
|
||||
elements["element_"+i].reactions[elementslist[Math.floor(Math.random()*elementslist.length)]] = { elem1: elementslist[Math.floor(Math.random()*elementslist.length)], elem2: elementslist[Math.floor(Math.random()*elementslist.length)]}
|
||||
}
|
||||
// console.log(i + " is done!")
|
||||
console.log(i)
|
||||
console.log(elements["element_"+i].behavior)
|
||||
}
|
||||
Loading…
Reference in New Issue