Re: How to generate a random string ...

2015-03-17 Thread Panke via Digitalmars-d-learn
On Monday, 16 March 2015 at 13:33:55 UTC, Robert burner Schadek wrote: ... from all Unicode characters in an idiomatic D way? (std.interal.unicode_*) ``` T genUnicodeString(T)(size_t minChars, size_t maxChars) if(isSomeString!T) { ... } ``` You'll need two things. A uniform distribution

Re: How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Monday, 16 March 2015 at 22:19:52 UTC, Gary Willoughby wrote: I guess it depends on the encoding? No the character itself are encoding independent. Some references: http://stackoverflow.com/questions/23853489/generate-a-random-unicode-string This will not work as the caller has to speci

Re: How to generate a random string ...

2015-03-16 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 16 March 2015 at 13:33:55 UTC, Robert burner Schadek wrote: ... from all Unicode characters in an idiomatic D way? (std.interal.unicode_*) ``` T genUnicodeString(T)(size_t minChars, size_t maxChars) if(isSomeString!T) { ... } ``` I guess it depends on the encoding? Some refe

Re: How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Monday, 16 March 2015 at 18:48:29 UTC, bearophile wrote: Perhaps by rejection? I mean, generating a uint, test if it's a character and repeat until the result is true. hm, that must not even terminate.

Re: How to generate a random string ...

2015-03-16 Thread bearophile via Digitalmars-d-learn
Robert burner Schadek: ... from all Unicode characters in an idiomatic D way? Perhaps by rejection? I mean, generating a uint, test if it's a character and repeat until the result is true. Bye, bearophile

How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
... from all Unicode characters in an idiomatic D way? (std.interal.unicode_*) ``` T genUnicodeString(T)(size_t minChars, size_t maxChars) if(isSomeString!T) { ... } ```