This example uses a predefined syllabary to produce random pronounceable strings. Reload to create new strings.
Last active
January 2, 2016 07:39
-
-
Save nitaku/8270950 to your computer and use it in GitHub Desktop.
Random pronounceable strings
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
window.main = () -> | |
syllables = ['bi','bo','bu','ta','se','tri','su','ke','ka','flo','ko','pi','pe','no','go','zo','fu','fo','si','pa','ar','es','i','kya','kyu','fle','o','ne','na','le','lu','ma','an'] | |
randlen = () -> 2+Math.floor(Math.random()*4) | |
randsy = () -> syllables[Math.floor(Math.random()*syllables.length)] | |
body = d3.select('body') | |
for i in [0...11] | |
body.append('div') | |
.text((randsy() for j in [0...randlen()]).join('')) | |
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
body { | |
margin-top: 40px; | |
margin-left: 60px; | |
} | |
div { | |
text-transform: capitalize; | |
font-size: 22pt; | |
color: #333333; | |
margin-bottom: 4px; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Random names</title> | |
<link type="text/css" href="index.css" rel="stylesheet"/> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="index.js"></script> | |
</head> | |
<body onload="main()"> | |
</body> | |
</html> |
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
(function() { | |
window.main = function() { | |
var body, i, j, randlen, randsy, syllables, _results; | |
syllables = ['bi', 'bo', 'bu', 'ta', 'se', 'tri', 'su', 'ke', 'ka', 'flo', 'ko', 'pi', 'pe', 'no', 'go', 'zo', 'fu', 'fo', 'si', 'pa', 'ar', 'es', 'i', 'kya', 'kyu', 'fle', 'o', 'ne', 'na', 'le', 'lu', 'ma', 'an']; | |
randlen = function() { | |
return 2 + Math.floor(Math.random() * 4); | |
}; | |
randsy = function() { | |
return syllables[Math.floor(Math.random() * syllables.length)]; | |
}; | |
body = d3.select('body'); | |
_results = []; | |
for (i = 0; i < 11; i++) { | |
_results.push(body.append('div').text(((function() { | |
var _ref, _results2; | |
_results2 = []; | |
for (j = 0, _ref = randlen(); 0 <= _ref ? j < _ref : j > _ref; 0 <= _ref ? j++ : j--) { | |
_results2.push(randsy()); | |
} | |
return _results2; | |
})()).join(''))); | |
} | |
return _results; | |
}; | |
}).call(this); |
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
body | |
margin-top: 40px | |
margin-left: 60px | |
div | |
text-transform: capitalize | |
font-size: 22pt | |
color: #333 | |
margin-bottom: 4px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment