Skip to content

Instantly share code, notes, and snippets.

@canerbasaran
Last active November 19, 2022 09:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save canerbasaran/9440338 to your computer and use it in GitHub Desktop.
Save canerbasaran/9440338 to your computer and use it in GitHub Desktop.
Rastgele TC Kimlik No Üreticisi (javascript)
<!--
Rastgele TC Kimlik No Üreticisi
Random Turkish Identification Number Generator
https: //github.com/CanerBasaran
-->
<html><p id="tc"></p>
<script type="text/javascript">
var tcno = "" + Math.floor(900000001 * Math.random() + 1e8),
list = tcno.split("").map(function(t) {
return parseInt(t, 10)
}),
tek = list[0] + list[2] + list[4] + list[6] + list[8],
cift = list[1] + list[3] + list[5] + list[7],
tc10 = (7 * tek - cift) % 10;
document.getElementById("tc").textContent = tcno + ("" + tc10) + ("" + (cift + tek + tc10) % 10)
</script></html>
@canerbasaran
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment