x(New Random().Next(x.Count))
x(Random.Shared.Next(x.Count))
subtype Element_Type is Integer;
type List_Type is array (Positive range <>) of Element_Type;
function Pick_Random (X : List_Type) return Element_Type is
subtype Index_Range is Positive range X'Range;
package Random_Index is new
Ada.Numerics.Discrete_Random (Index_Range);
Generator : Random_Index.Generator;
begin
Random_Index.Reset (Generator);
return X (Random_Index.Random (Generator));
end Pick_Random;
std::mt19937 gen;
std::uniform_int_distribution<size_t> uid (0, x.size () - 1);
x[uid (gen)];
std::ranges::sample(x, &result, 1, std::mt19937{std::random_device{}()});
x[Random.Shared.Next(x.Count)]
x[new Random().Next(x.Count)]
x[new Random().nextInt(x.length)];
lists:nth(rand:uniform(length(X)), X).
call random_number (a)
x(lbound(x) + int(a*ubound(x))
func pickT(x []T) T {
return x[rand.Intn(len(x))]
}
func pick[T any](x []T) T {
return x[rand.Intn(len(x))]
}
(\l g -> l !! fst (randomR (0, length l) g))
(l !!) <$> randomRIO (0, length l - 1)
x[~~(Math.random() * x.length)];
x[Math.floor(Math.random() * x.length)]
if (!x.isEmpty()) {
Random r = new Random();
T t = x.get(r.nextInt(x.size()));
}
x.get((int)(Math.random()*x.size()))
x.get(ThreadLocalRandom.current().nextInt(0, x.size()))
(nth (random (length x)) x)
x[arc4random_uniform(x.count)]
element := x.Items[random(x.count)];
element := x[random(length(x))];
my @x = ('a', 'list', 'of', 'random', 'items');
print $x[rand @x];
let mut rng = rand::thread_rng();
let choice = x.choose(&mut rng).unwrap();
x[rand::thread_rng().gen_range(0..x.len())]
val x = List(1, 2, 3, 4)
x.apply(Random.nextInt(x.size))
(list-ref x (random (length x)))