Skip to main content

Random text tool

I recently blogged about some of the tools I use, and how some are so useful I keep using them. As I mentioned, randomness is pretty useful, and I have tools to help me generate random text.

A few of my readers requested a copy of my simple random text generating script, so I've decided to open it up for everyone to use and test. It will have bugs, like all software, please send details and I'll try and fix them.

If you are interested in what UTF-8 is and what all that Unicode stuff is about, there is a great article by Joel Spolsky that explains all, and the wikipedia page is ok.

To use it...

First download the script, its on GitHub. The script is fairly short and is all in one file. You don't have to 'install it', its not a GEM.

Second, make sure you have Ruby version 1.9 or greater. You need version 1.9, because Ruby didn't handle UTF-8 well in older versions.

Thirdly run the script like this:

ruby fuzzutf8.rb

That will give you some usage examples.

Typically you might use it like this:

ruby fuzzutf8.rb -c 100 -utf8_two_byte
ծݸԒ̂ƍՔ͌вЊޏΒđµʠ£أҋ‘ŷݟߢ؁ˬУԝψĭ͕ѼХׅ۲ѨÃːׁǡ ܮ͂ϗՎœߔƭ̷Ȼ̧ʕʏٔǝ͈ܰȄبǚŎڿξަدʓ׽߷ЊݑڷũɛӥѤ̸ôߋȭԭæúѫܚʽͫʔƦܾ߷Ûƕͱ՛عӯ̨֢د߻Ӈ

That's a hundred code-points of UTF-8, in the two byte range.

As operating systems sometimes have issues copying and pasting these code-points (e.g. Windows XP) You may prefer to redirect the contents straight to a text file. e.g.:

ruby fuzzutf8.rb -c 100 -utf8_two_byte > random_utf8_file.txt

You can then treat the output like any other file. You can open it in a text editor, but beware many programs can not handle random UTF8 well, You may wish to save your work first.

The script also allows you to keep a record of the code-point numbers generated in a separate file ( -o option). These can then be replayed at a later date should you need to ( -r option ). The script doesn't do a lot of validation, so you can probably have great fun tripping the script itself up with dodgy inputs and arguments ;-)

I'm confident the script has many bugs, but it is nonetheless quite useful, and has been useful in helping me to locate other bugs. If you are interested in random text generators, There is a windows tool that I've also found useful, called Babel from TestMentor. Babel allows you to choose the output by character set/codepoint range, which is also interesting.


Popular posts from this blog

Why you might need testers

I remember teaching my son to ride his bike. No, Strike that, Helping him to learn to ride his bike. It’s that way round – if we are honest – he was changing his brain so it could adapt to the mechanism and behaviour of the bike. I was just holding the bike, pushing and showering him with praise and tips.
If he fell, I didn’t and couldn’t change the way he was riding the bike. I suggested things, rubbed his sore knee and pointed out that he had just cycled more in that last attempt – than he had ever managed before - Son this is working, you’re getting it.
I had help of course, Gravity being one. When he lost balance, it hurt. Not a lot, but enough for his brain to get the feedback it needed to rewire a few neurons. If the mistakes were subtler, advice might help – try going faster – that will make the bike less wobbly. The excitement of going faster and better helped rewire a few more neurons.
When we have this sort of immediate feedback we learn quicker, we improve our game. When the f…

Thank you for finding the bug I missed.

Thank you to the colleague/customer/product owner, who found the bug I missed. That oversight, was (at least in part) my mistake. I've been thinking about what happened and what that means to me and my team.

I'm happy you told me about the issue you found, because you...

1) Opened my eyes to a situation I'd never have thought to investigate.

2) Gave me another item for my checklist of things to check in future.

3) Made me remember, that we are never done testing.

4) Are never sure if the application 'works' well enough.

5) Reminded me to explore more and build less.

6) To request that we may wish to assign more time to finding these issues.

7) Let me experience the hindsight bias, so that the edge-case now seems obvious!

Google Maps Queue Jumps.

Google Maps directs me to and from my client sites. I've saved the location of the client's car parks, when I start the app in the morning - it knows where I want to go. When I start it at the end of the day, Google knows where I want to go.
This is great! It guides me around traffic jams, adjusts when I miss a turn and even offers faster routes en-route as they become available.
But sometimes Google Maps does something wrong. I don't mean incorrect, like how it sometimes gets a street name wrong (typically in a rural area). I don't mean how its GPS fix might put me in a neighbouring street (10m to my left - when there are trees overhead).
I mean wrong - As in something unfair and socially unacceptable. An action, that if a person did it, would be frowned upon.
Let’s assume a road has a traffic jam, so instead of the cars doing around 60 mph, we are crawling at <10 mph.
In the middle of this traffic jam, the road has a junction, an example is shown here: