Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To generate a string you may try to use this function:</p> <pre><code> private static string GenerateString(int length, int minCharCode, int maxCharCode) { var builder = new StringBuilder(length); var random = new Random(); for (var i = 0; i &lt; length; i++) { builder.Append((char) random.Next(minCharCode, maxCharCode)); } return builder.ToString(); } </code></pre> <p><strong>minCharCode</strong> and <strong>maxCharCode</strong> set your unicode characters range. You may call this function hundreds times. And if you whant a variable-length strings you may randomize <strong>length</strong> parameter at each call. Usage:</p> <pre><code> static void Main(string[] args) { const int minJpnCharCode = 0x4e00; const int maxJpnCharCode = 0x4f80; var random = new Random(); for (int i = 0; i &lt; 10000; i++) { Console.WriteLine(GenerateString(random.Next(0, 50), minJpnCharCode, maxJpnCharCode)); } Console.ReadLine(); } </code></pre> <p><strong>Update</strong> Chinese and japanese chars has many ranges in unicode. You may take it from here <a href="http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml" rel="nofollow">Japanese</a> or just use Google. Than you need the next code:</p> <pre><code> /// &lt;summary&gt; /// Represents our characters range /// &lt;/summary&gt; class Range { public int Begin { get; set; } public int End { get; set; } public Range(int begin, int end) { Begin = begin; End = end; } } </code></pre> <p>Our generator:</p> <pre><code> private static string GenerateString(int length, IList&lt;Range&gt; ranges) { var builder = new StringBuilder(length); var random = new Random(); for (var i = 0; i &lt; length; i++) { var rangeIndex = random.Next(ranges.Count); var range = ranges[rangeIndex]; builder.Append((char)random.Next(range.Begin, range.End)); } return builder.ToString(); } </code></pre> <p>Usage:</p> <pre><code> var ranges = new[] { new Range(0x4e00, 0x4f80), new Range(0x5000, 0x9fa0), new Range(0x3400, 0x4db0), new Range(0x30a0, 0x30f0), // and so on.. add any range here }; for (var i = 0; i &lt; 10000; i++) { Console.WriteLine(GenerateString(random.Next(0, 50), ranges)); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload