generador de números aleatorios c#
Random rnd = new Random();
int month = rnd.Next(1, 13); // creates a number between 1 and 12
int dice = rnd.Next(1, 7); // creates a number between 1 and 6
int card = rnd.Next(52); // creates a number between 0 and 51
Generador de cadenas aleatorias PHP
function generateRandomString($length = 25) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
//usage
$myRandomString = generateRandomString(5);
generador de color aleatorio javascript
function generateRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
var randomColor=generateRandomColor();//"#F10531"
palabra aleatoria usando una lista de palabras php
// Read the whole file into a array.
$file = file('File Location');
// Getting the Words Count in the file.
$wCount = count($file);
// Printing out the random word.
echo $file[rand(0, $wCount - 1)];
// This is a one liner.
echo file('File Location')[rand(0, count(file('File Location')) - 1)];
Generar Cadena aleatoria en PHP
phpCopy<?php
function random_str_generator ($len_of_gen_str){
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
$var_size = strlen($chars);
echo "Random string =";
for( $x = 0; $x < $len_of_gen_str; $x++ ) {
$random_str= $chars[ rand( 0, $var_size - 1 ) ];
echo $random_str;
}
echo "\n";
}
random_str_generator (8)
?>