Tag Archives: floor

How to create a Variable Length String of Random Characters using JavaScript Programming 04 MAY 2012

Generating random strings is always necessary when working with things like voucher or password generation, and so today’s quick JavaScript function looks at returning a specified length of string containing a a selection of randomly selected characters and numbers.

The function works by specifying a string containing all the characters you wish to be used in your randomly generated string. Using the random() function and mixing it up a little to generate essentially a character position, we can grab a character off the previously mentioned character string. Rinse and repeat for the desired length of string, adding everything together to at last come up with your string of random characters.

function randomString(string_length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	return randomstring;

Nice and random, just like this image.


Oh Noes, the attack of the Toes! Jessica 20 SEP 2011

Oh noes, little baby Jessie is under attack from Daddy’s noisy toes! Not that it seems to deter this little intrepid adventurer mind you, seeing as she keeps going back for more! :)

If you know the layout of our house, then you’ll notice that the coffee table is no longer in its usual spot. It has been consigned to a lonely corner in the lounge, opening up acres of prime real estate in terms of floor space, more than enough to throw a couple of soft and warm blankets down on top of.

And with this great new play space available to the spectacular team of Daddy and Jessica and the various squishy toys, you can be sure that I now spend 92.3% of my time here at home, flat on the floor amongst all the dust bunnies and cat fur that seems to come along with the territory! :)

(In case you were wondering, this was shot just after I had returned home from karate practice, hence the peculiar white pants, getting ready to give Jessie her night time bottle, and of course play with her enough (read tire her out) so that she’s ready for a good night’s sleep!)