JavaScript random numbers examples

Generating random numbers is a common thing in programming. Here is some examples in JavaScript:

//Basic Random
Math.random();
//From 0 to specific number
Math.random() * 10;
//Removing decimals
Math.floor(Math.random() * 10);
//Random between 5 and 10
Math.floor(Math.random() * 5) + 5;
//Random between 5 and 10 (included 10)
Math.floor(Math.random() * 5) + 6;

Very easy and simple .htaccess & PHP tutorial

If you work with PHP, you notice that this URL: http://yoursite.com/index.php?post=2 is not pretty at all. There is term “Pretty URL” and a lot of tutorials how to make your URL prettier. In this post I’m going to share a few line of .htaccess codes to make your URL more prettier.