CellBIS::Random - Tool for Randomize characters in strings.
use CellBIS::Random; my $rand = CellBIS::Random->new(); my $string = 'my_string_test_random'; $rand->set_string($random); my $random = $rand->random(2, 3); print 'Random : ', $random, "\r"; #-> ynsn_dtgso__tmrtrmaei my $unrandom = $rand->unrandom(2, 3); print 'Unrandom : ', $unrandom, "\r"; #-> my_string_test_random
The purpose of this module is to randomize characters in strings. Before a random or unrandom character (extract from random), the string will be converted to an array to get an odd/even number of key array.
There is four methods set_string, get_result, random and unrandom.
set_string
get_result
random
unrandom
Specifically for random and unrandom methods, you can use two or three arguments. If using Object Oriented, you can use 2 arguments. But if using Procedural, you can use 3 arguments.
# Object Oriented # Arguments : <number_of_random_odd>, <number_of_random_even> $rand->random(2, 3); $rand->unrandom(2, 3); # Or Arguments : <your_string_to_random>, <number_of_random_odd>, <number_of_random_even> $rand->random('your string to random', 2, 3); $rand->unrandom('result of random to extract', 2, 3); # Procedural # Arguemnts : <your_string_to_random>, <number_of_random_odd>, <number_of_random_even> CellBIS::Random->random('your string to random', 2, 3); CellBIS::Random->unrandom('result of random to extract', 2, 3);
Method to set up string for Random action.
Method to get result of random character and Extract result of random.
With set_string :
use CellBIS::Random; my $string = 'my string here'; $rand->set_string($string); my $result_random = $rand->random(2, 3); print "Random Result : $result_random \n";
Without set_string :
my $result_random = $rand->random('my string here', 2, 3); print "Random Result : $result_random \n";
$rand->set_string($result_random); my $result_unrandom = $rand->unrandom(2, 3); print "Extract Random Result : $result_unrandom \n";
my $result_unrandom = $rand->unrandom($rand->{result}, 2, 3); print "Extract Random Result : $result_unrandom \n";
Example to using Procedural and Object Oriented
Case 1
use CellBIS::Random; my $result_random = CellBIS::Random->random('my string here', 2, 3); print "Random Result : $result_random \n"; my $extract_random = CellBIS::Random->unrandom($result_random, 2, 3); print "Extract Random Result : $extract_random \n";
Case 2
use CellBIS::Random; my $rand = CellBIS::Random->new(); my $result_random = $rand->random('my string here', 2, 3); print "Random Result : $result_random \n"; my $extract_random = $rand->unrandom($result_random, 2, 3); print "Extract Random Result : $extract_random \n";
use CellBIS::Random; my $rand = CellBIS::Random->new(); # For Random $rand->set_string('my string here'); $rand->random(2, 3); my $result_random = $rand->get_result(); print "Random Result : $result_random \n"; ===================================================== # For Extract Random $rand->set_string($result_random); $rand->unrandom(2, 3); my $extract_random = $rand->get_result(); print "Extract Random Result : $extract_random \n";
use CellBIS::Random; my $rand = CellBIS::Random->new(); # For Random $rand->set_string('my string here'); my $result_random = $rand->random('my string here', 2, 3); print "Random Result : $result_random \n"; ===================================================== # For Extract Random my $extract_random = $rand->unrandom($result_random, 2, 3); print "Extract Random Result : $extract_random \n";
Case 3
use CellBIS::Random; my $rand = CellBIS::Random->new(); # For Random my $result_random = $rand->random('my string here', 2, 3); print "Random Result : $result_random \n"; ===================================================== # For Extract Random my $extract_random = $rand->unrandom($result_random, 2, 3); print "Extract Random Result : $extract_random \n";
Achmad Yusri Afandi, <yusrideb@cpan.org>
Copyright (C) 2018 by Achmad Yusri Afandi
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
To install CellBIS::Random, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CellBIS::Random
CPAN shell
perl -MCPAN -e shell install CellBIS::Random
For more information on module installation, please visit the detailed CPAN module installation guide.