Created
September 6, 2017 15:04
-
-
Save volkanozcan2/9b8a3acdf8207d8fb4c3566b1e7b000d to your computer and use it in GitHub Desktop.
createBinaryHuman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fs = require("fs"); | |
let wr = fs.createWriteStream("./humans"); | |
let stream = require("stream"); | |
Number.prototype.toHex = function(digits = 2) { | |
let l = this.valueOf().toString(16); | |
if (digits - l.length <= 0) { | |
return l | |
} else { | |
return Array((digits - l.length) + 1).join("0") + l | |
} | |
}; | |
function reBuf(s, a, l, n, sn) { | |
let str = [s.toHex(1), a.toHex(), l.toHex(), n.toHex(4), sn.toHex(5)].join(""); | |
return Buffer.from(str, "hex"); | |
} | |
for (var a = 0; a < 1e5; a++) { | |
wr.write(reBuf(1, ~~(Math.random() * 100), ~~(Math.random() * 195), ~~(Math.random() * 5494), ~~(Math.random() * 88799))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment