• Important! If you attempt to register and do not get an email within 5 minutes please check your spam box. This is especially true for Microsoft owned domains like Hotmail, Outlook, and Live. If these do not work please consider Gmail. Yahoo, or even AOL email which works fine.

ran (random text) BB Code

BirdOPrey5

Staff member
Administrator
VIP
[NOBB][ran][/NOBB]

[NOBB][ran] [/ran][/NOBB] randomizes all text in-between the tags. All characters, including spaces and punctuations are randomized. I prefer to put the period ending the sentence outside the tag.

Examples:
[NOBB][ran]This is my random sentence[/ran].[/NOBB] =
[ran]This is my random sentence[/ran].

[NOBB][ran]There is no point but this has also been randomized[/ran].[/NOBB] =
[ran]There is no point but this has also been randomized[/ran].

Warning: Do not use double quotes ("), ampersands (&), or square or corner brackets ([<>]) inside this tag.
Dollar signs ($) and other common punctuation (!, ?, ,) are OK.
Also you can not use other bb code or smilies within this tag as they will be randomized as well. You can use bb code OUTSIDE the tag however.

[NOBB][ran]A bold 'example'[/ran].[/NOBB] =
[ran]A bold 'example'[/ran].

Finally if you edit a post with this code you may have to refresh the page to see it. (The Javascript needs to load.)
 

BirdOPrey5

Staff member
Administrator
VIP
I found this Javascrpt already created on the web and have left the copyright info in tact. I made minor changes to adapt it to a BB Code.

Add a new BBCode

Title: Random (Shuffle) Text
BB Code Tag Name: ran
Replacement:
Code:
<script type="text/javascript">
function str_shuffle (str) {
    // Shuffles string. One permutation of all possible is created  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/str_shuffle
    // +   original by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: shuffled = str_shuffle("abcdef");
    // *     results 1: shuffled.length == 6
    
    if (str == undefined) {
        throw 'Wrong parameter count for str_shuffle()';
    }
    
    var getRandomInt = function (max) {
        return Math.floor(Math.random() * (max + 1));
    }
    var newStr = '', rand = 0;
    
    while (str.length) {
        rand = getRandomInt(str.length-1);
        newStr += str.charAt(rand);
        str = str.substring(0, rand)+str.substr(rand+1);
    }
    
    return newStr;
}
</script> 
<script>
document.write(str_shuffle("{param}"));
</script>
Example: [NOBB][ran]This is a random test[/ran][/NOBB].
Description: This code shuffles text. Do not use the following characters: " {}[]<>&
Use Option: No
Button Image: (optional) attached.
Remove Tag If Empty: Yes
All Disable Options: Yes

The following special characters do not work: " {}[]<>& (There may be others)
The following special characters do work: .,!?$()
 

Attachments

Top