Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
category:
- Randomness
from: http://rosettacode.org/wiki/Pick_random_element
note: Basic language learning

View file

@ -0,0 +1,3 @@
Demonstrate how to pick a random element from a list.
<br><br>

View file

@ -0,0 +1 @@
print(random:choice([foo, bar, baz]))

View file

@ -0,0 +1,30 @@
.model small
.stack 1024
.data
TestList byte 00h,05h,10h,15h,20h,25h,30h,35h
.code
start:
mov ax,@data
mov ds,ax
mov ax,@code
mov es,ax
call seedXorshift32 ;seeds the xorshift rng using the computer's date and time
call doXorshift32
mov ax,word ptr [ds:xorshift32_state_lo] ;retrieve the rng output
and al,00000111b ;constrain the rng to values 0-7
mov bx,offset TestList
XLAT ;translate AL according to [DS:BX]
call PrintHex ;display AL to the terminal
mov ax,4C00h
int 21h ;exit program and return to MS-DOS
end start

View file

@ -0,0 +1,6 @@
:set-state-ok t
(defun pick-random-element (xs state)
(mv-let (idx state)
(random$ (len xs) state)
(mv (nth idx xs) state)))

View file

@ -0,0 +1,23 @@
# pick a random element from an array of strings #
OP PICKRANDOM = ( []STRING list )STRING:
BEGIN
INT number of elements = ( UPB list - LWB list ) + 1;
INT random element =
ENTIER ( next random * ( number of elements ) );
list[ LWB list + random element ]
END; # PICKRANDOM #
# can define additional operators for other types of array #
main: (
[]STRING days = ( "Sunday", "Monday", "Tuesday", "Wednesday"
, "Thursday", "Friday", "Saturday"
);
print( ( PICKRANDOM days, newline ) )
)

View file

@ -0,0 +1 @@
pickRandom (?)

View file

@ -0,0 +1,8 @@
# syntax: GAWK -f PICK_RANDOM_ELEMENT.AWK
BEGIN {
n = split("Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",day_of_week,",")
srand()
x = int(n*rand()) + 1
printf("%s\n",day_of_week[x])
exit(0)
}

View file

@ -0,0 +1,19 @@
PROC Main()
DEFINE PTR="CARD"
PTR ARRAY a(7)
BYTE i,index
a(0)="Monday"
a(1)="Tuesday"
a(2)="Wednesday"
a(3)="Thursday"
a(4)="Friday"
a(5)="Saturday"
a(6)="Sunday"
FOR i=1 TO 20
DO
index=Rand(7)
PrintE(a(index))
OD
RETURN

View file

@ -0,0 +1,30 @@
with Ada.Text_IO, Ada.Numerics.Float_Random;
procedure Pick_Random_Element is
package Rnd renames Ada.Numerics.Float_Random;
Gen: Rnd.Generator; -- used globally
type Char_Arr is array (Natural range <>) of Character;
function Pick_Random(A: Char_Arr) return Character is
-- Chooses one of the characters of A (uniformly distributed)
begin
return A(A'First + Natural(Rnd.Random(Gen) * Float(A'Last)));
end Pick_Random;
Vowels : Char_Arr := ('a', 'e', 'i', 'o', 'u');
Consonants: Char_Arr := ('t', 'n', 's', 'h', 'r', 'd', 'l');
Specials : Char_Arr := (',', '.', '?', '!');
begin
Rnd.Reset(Gen);
for J in 1 .. 3 loop
for I in 1 .. 10 loop
Ada.Text_IO.Put(Pick_Random(Consonants));
Ada.Text_IO.Put(Pick_Random(Vowels));
end loop;
Ada.Text_IO.Put(Pick_Random(Specials) & " ");
end loop;
Ada.Text_IO.New_Line;
end Pick_Random_Element;

View file

@ -0,0 +1,11 @@
list l;
l_append(l, 'a');
l_append(l, 'b');
l_append(l, 'c');
l_append(l, 'd');
l_append(l, 'e');
l_append(l, 'f');
o_byte(l[drand(5)]);
o_byte('\n');

View file

@ -0,0 +1 @@
get some item of [1, "two", pi, "4", 5 > 4, 5 + 1, Sunday]

View file

@ -0,0 +1,9 @@
10 DIM A$(9)
20 FOR I = 0 TO 9: READ A$(I): NEXT
25 TI = PEEK(78) + PEEK(79)*256
30 X = RND ( - TI): REM 'PLANT A RANDOM SEED'
40 X = INT ( RND (1) * 10)
50 PRINT A$(X)
60 END
100 DATAALPHA, BRAVO, CHARLIE, DELTA, ECHO
110 DATAFOXTROT, GOLF, HOTEL, INDIA, JULIETT

View file

@ -0,0 +1,3 @@
fruit: ["apple" "banana" "pineapple" "apricot" "watermelon"]
print sample fruit

View file

@ -0,0 +1,3 @@
list := ["abc", "def", "gh", "ijklmnop", "hello", "world"]
Random, randint, 1, % list.MaxIndex()
MsgBox % List[randint]

View file

@ -0,0 +1,4 @@
list := "abc,def,gh,ijklmnop,hello,world"
StringSplit list, list, `,
Random, randint, 1, %list0%
MsgBox % List%randint%

View file

@ -0,0 +1,13 @@
'setup
DIM foo(10) AS LONG
DIM n AS LONG, x AS LONG
FOR n = LBOUND(foo) TO UBOUND(foo)
foo(n) = INT(RND*99999)
NEXT
RANDOMIZE TIMER
'random selection
x = INT(RND * ((UBOUND(foo) - LBOUND(foo)) + 1))
'output
PRINT x, foo(x)

View file

@ -0,0 +1,6 @@
dim a$ = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}
for i = 1 to 5
randInt = int(rand * 10)
print a$[randInt]
next i

View file

@ -0,0 +1,4 @@
DIM list$(5)
list$() = "The", "five", "boxing", "wizards", "jump", "quickly"
chosen% = RND(6)
PRINT "Item " ; chosen% " was chosen which is '" list$(chosen%-1) "'"

View file

@ -0,0 +1,2 @@
PR {𝕩˜•rand.Range 𝕩}
PR1 •rand.Range

View file

@ -0,0 +1,4 @@
PR 567723
67
PR1 567723
7

View file

@ -0,0 +1,8 @@
' Pick random element
OPTION BASE 1
DECLARE words$[6]
FOR i = 1 TO 6 : READ words$[i] : NEXT
DATA "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta"
element = RANDOM(6) + 1
PRINT "Chose ", element, ": ", words$[element]

View file

@ -0,0 +1,16 @@
@echo off
setlocal enabledelayedexpansion
::Initializing the pseudo-array...
set "pseudo=Alpha Beta Gamma Delta Epsilon"
set cnt=0 & for %%P in (!pseudo!) do (
set /a cnt+=1
set "pseudo[!cnt!]=%%P"
)
::Do the random thing...
set /a rndInt=%random% %% cnt +1
::Print the element corresponding to rndint...
echo.!pseudo[%rndInt%]!
pause
exit /b

View file

@ -0,0 +1,2 @@
blsq ) "ABCDEFG"123456 0 6rn-]!!
'G

View file

@ -0,0 +1,15 @@
#include <iostream>
#include <random>
#include <vector>
int main( ) {
std::vector<int> numbers { 11 , 88 , -5 , 13 , 4 , 121 , 77 , 2 } ;
std::random_device seed ;
// generator
std::mt19937 engine( seed( ) ) ;
// number distribution
std::uniform_int_distribution<int> choose( 0 , numbers.size( ) - 1 ) ;
std::cout << "random element picked : " << numbers[ choose( engine ) ]
<< " !\n" ;
return 0 ;
}

View file

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
class RandomElementPicker {
static void Main() {
var list = new List<int>(new[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
var rng = new Random();
var randomElement = list[rng.Next(list.Count)];
Console.WriteLine("I picked element {0}", randomElement);
}
}

View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
char array[] = { 'a', 'b', 'c','d','e','f','g','h','i','j' };
int i;
time_t t;
srand((unsigned)time(&t));
for(i=0;i<30;i++){
printf("%c\n", array[rand()%10]);
}
return 0;
}

View file

@ -0,0 +1,15 @@
random_element = proc [T: type] (a: array[T]) returns (T)
return(a[array[T]$low(a) + random$next(array[T]$size(a))])
end random_element
start_up = proc ()
po: stream := stream$primary_output()
d: date := now()
random$seed(d.second + 60*(d.minute + 60*d.hour))
arr: array[string] := array[string]$["foo", "bar", "baz", "qux"]
for i: int in int$from_to(1,5) do
stream$putl(po, random_element[string](arr))
end
end start_up

View file

@ -0,0 +1,16 @@
>>SOURCE FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. random-element.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 nums-area VALUE "123456789".
03 nums PIC 9 OCCURS 9 TIMES.
01 random-idx PIC 9 COMP.
PROCEDURE DIVISION.
COMPUTE random-idx = FUNCTION RANDOM(FUNCTION CURRENT-DATE (9:7)) * 9 + 1
DISPLAY nums (random-idx)
.
END PROGRAM random-element.

View file

@ -0,0 +1,10 @@
import ceylon.random {
DefaultRandom
}
shared void run() {
value random = DefaultRandom();
value element = random.nextElement([1, 2, 3, 4, 5, 6]);
print(element);
}

View file

@ -0,0 +1 @@
(rand-nth coll)

View file

@ -0,0 +1 @@
(nth coll (rand-int (count coll)))

View file

@ -0,0 +1,2 @@
array = [1,2,3]
console.log array[Math.floor(Math.random() * array.length)]

View file

@ -0,0 +1,8 @@
10 DIM A$(9)
20 FOR I=0 TO 9 : READ A$(I) : NEXT
30 X = RND(-TI) : REM 'PLANT A RANDOM SEED'
40 X = INT(RND(1)*10)
50 PRINT A$(X)
60 END
100 DATA ALPHA, BRAVO, CHARLIE, DELTA, ECHO
110 DATA FOXTROT, GOLF, HOTEL, INDIA, JULIETT

View file

@ -0,0 +1,5 @@
(defvar *list* '(one two three four five))
(print (nth (random (length *list*)) *list*))
(print (nth (random (length *list*)) *list*))
(print (nth (random (length *list*)) *list*))

View file

@ -0,0 +1 @@
puts [1, 2, 3, 4, 5].sample(1)

View file

@ -0,0 +1,6 @@
import std.stdio, std.random;
void main() {
const items = ["foo", "bar", "baz"];
items[uniform(0, $)].writeln;
}

View file

@ -0,0 +1,3 @@
for each int i in range(5)
writeLine(random(text["Dee", "do", "de", "de"]))
end

View file

@ -0,0 +1,2 @@
ar$[] = [ "spring" "summer" "autumn" "winter" ]
print ar$[random len ar$[]]

View file

@ -0,0 +1,4 @@
(define (pick-random list)
(list-ref list (random (length list))))
(pick-random (iota 1000)) → 667
(pick-random (iota 1000)) → 179

View file

@ -0,0 +1,14 @@
import extensions;
extension listOp
{
randomItem()
= self[randomGenerator.eval(self.Length)];
}
public program()
{
var item := new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
console.printLine("I picked element ",item.randomItem())
}

View file

@ -0,0 +1,6 @@
iex(1)> list = Enum.to_list(1..20)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
iex(2)> Enum.random(list)
19
iex(3)> Enum.take_random(list,4)
[19, 20, 7, 15]

View file

@ -0,0 +1,5 @@
(defun random-choice (items)
(nth (random (length items)) items))
(random-choice '("a" "b" "c"))
;; => "a"

View file

@ -0,0 +1,8 @@
% Implemented by Arjun Sunel
-module(pick_random).
-export([main/0]).
main() ->
List =[1,2,3,4,5],
Index = rand:uniform(length(List)),
lists:nth(Index,List).

View file

@ -0,0 +1,2 @@
constant s = {'a', 'b', 'c'}
puts(1,s[rand($)])

View file

@ -0,0 +1,3 @@
let list = ["a"; "b"; "c"; "d"; "e"]
let rand = new System.Random()
printfn "%s" list.[rand.Next(list.Length)]

View file

@ -0,0 +1,2 @@
( scratchpad ) { "a" "b" "c" "d" "e" "f" } random .
"a"

View file

@ -0,0 +1,2 @@
lst = [1, 3, 5, 8, 10]
> randomPick(lst)

View file

@ -0,0 +1,11 @@
program pick_random
implicit none
integer :: i
integer :: a(10) = (/ (i, i = 1, 10) /)
real :: r
call random_seed
call random_number(r)
write(*,*) a(int(r*size(a)) + 1)
end program

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win64
Dim a(0 To 9) As String = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}
Randomize
Dim randInt As Integer
For i As Integer = 1 To 5
randInt = Int(Rnd * 10)
Print a(randInt)
Next
Sleep

View file

@ -0,0 +1,2 @@
a = ["one", "two", "three"]
println[random[a]]

View file

@ -0,0 +1,2 @@
a := [2, 9, 4, 7, 5, 3];
Random(a);

View file

@ -0,0 +1,3 @@
Random(SymmetricGroup(20));
(1,4,8,2)(3,12)(5,14,10,18,17,7,16)(9,13)(11,15,20,19)

View file

@ -0,0 +1,7 @@
10 RANDOMIZE TIMER : REM set random number seed to something arbitrary
20 DIM ARR(10) : REM initialise array
30 FOR I = 1 TO 10
40 ARR(I) = I*I : REM squares of the integers is OK as a demo
50 NEXT I
60 C = 1 + INT(RND*10) : REM get a random index from 1 to 10 inclusive
70 PRINT ARR(C)

View file

@ -0,0 +1,6 @@
Public Sub Main()
Dim sList As String[] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
Print sList[Rand(0, 11)]
End

View file

@ -0,0 +1,14 @@
package main
import (
"fmt"
"math/rand"
"time"
)
var list = []string{"bleen", "fuligin", "garrow", "grue", "hooloovoo"}
func main() {
rand.Seed(time.Now().UnixNano())
fmt.Println(list[rand.Intn(len(list))])
}

View file

@ -0,0 +1,7 @@
def list = [25, 30, 1, 450, 3, 78]
def random = new Random();
(0..3).each {
def i = random.nextInt(list.size())
println "list[${i}] == ${list[i]}"
}

View file

@ -0,0 +1 @@
[25, 30, 1, 450, 3, 78].sort{new Random()}?.take(1)[0]

View file

@ -0,0 +1,12 @@
use fmt;
use math::random;
use datetime;
export fn main() void = {
const array = ["one", "two", "three", "four", "five"];
const seed = datetime::now();
const seed = datetime::nsec(&seed);
let r = math::random::init(seed: u32);
fmt::printfln("{}", array[math::random::u32n(&r, len(array): u32)])!;
};

View file

@ -0,0 +1,6 @@
import System.Random (randomRIO)
pick :: [a] -> IO a
pick xs = fmap (xs !!) $ randomRIO (0, length xs - 1)
x <- pick [1, 2, 3]

View file

@ -0,0 +1,2 @@
import Data.Random
sample $ randomElement [1, 2, 3]

View file

@ -0,0 +1,3 @@
do
x <- sample $ randomElement [1, 2, 3]
print x

View file

@ -0,0 +1,4 @@
procedure main()
L := [1,2,3] # a list
x := ?L # random element
end

View file

@ -0,0 +1,2 @@
({~ ?@#) 'abcdef'
b

View file

@ -0,0 +1,4 @@
import java.util.Random;
...
int[] array = {1,2,3};
return array[new Random().nextInt(array.length)]; // if done multiple times, the Random object should be re-used

View file

@ -0,0 +1,2 @@
var array = [1,2,3];
return array[Math.floor(Math.random() * array.length)];

View file

@ -0,0 +1 @@
< /dev/urandom tr -cd '0-9' | fold -w 1 | jq -MRcnr -f program.jq

View file

@ -0,0 +1,11 @@
# Output: a prn in range(0;$n) where $n is `.`
def prn:
if . == 1 then 0
else . as $n
| ([1, (($n-1)|tostring|length)]|max) as $w
| [limit($w; inputs)] | join("") | tonumber
| if . < $n then . else ($n | prn) end
end;
# An illustration - 10 selections at random with replacement:
range(0;10) | ["a", "b", "c"] | .[length|prn]

View file

@ -0,0 +1,2 @@
array = [1,2,3]
rand(array)

View file

@ -0,0 +1,2 @@
1?"abcdefg"
,"e"

View file

@ -0,0 +1,9 @@
include ..\Utilitys.tlhy
:pickran len rand * 1 + get ;
( 1 3.1415 "Hello world" ( "nest" "list" ) )
10 [drop pickran ?] for
" " input

View file

@ -0,0 +1,30 @@
// version 1.2.10
import java.util.Random
/**
* Extension function on any list that will return a random element from index 0
* to the last index
*/
fun <E> List<E>.getRandomElement() = this[Random().nextInt(this.size)]
/**
* Extension function on any list that will return a list of unique random picks
* from the list. If the specified number of elements you want is larger than the
* number of elements in the list it returns null
*/
fun <E> List<E>.getRandomElements(numberOfElements: Int): List<E>? {
if (numberOfElements > this.size) {
return null
}
return this.shuffled().take(numberOfElements)
}
fun main(args: Array<String>) {
val list = listOf(1, 16, 3, 7, 17, 24, 34, 23, 11, 2)
println("The list consists of the following numbers:\n${list}")
// notice we can call our extension functions as if they were regular member functions of List
println("\nA randomly selected element from the list is ${list.getRandomElement()}")
println("\nA random sequence of 5 elements from the list is ${list.getRandomElements(5)}")
}

View file

@ -0,0 +1,5 @@
local(
my array = array('one', 'two', 3)
)
#myarray -> get(integer_random(#myarray -> size, 1))

View file

@ -0,0 +1,3 @@
list$ ="John Paul George Ringo Peter Paul Mary Obama Putin"
wantedTerm =int( 10 *rnd( 1))
print "Selecting term "; wantedTerm; " in the list, which was "; word$( list$, wantedTerm, " ")

View file

@ -0,0 +1,2 @@
put "Apple,Banana,Peach,Apricot,Pear" into fruits
put item (random(the number of items of fruits)) of fruits

View file

@ -0,0 +1 @@
pick [1 2 3]

View file

@ -0,0 +1,3 @@
math.randomseed(os.time())
local a = {1,2,3}
print(a[math.random(1,#a)])

View file

@ -0,0 +1,2 @@
list = {'a','b','c'};
list{ceil(rand(1)*length(list))}

View file

@ -0,0 +1,2 @@
list = 1:1000;
list(ceil(rand(1)*length(list)))

View file

@ -0,0 +1,3 @@
a := [bear, giraffe, dog, rabbit, koala, lion, fox, deer, pony]:
randomNum := rand(1 ..numelems(a)):
a[randomNum()];

View file

@ -0,0 +1 @@
RandomChoice[{a, b, c}]

View file

@ -0,0 +1,4 @@
random_element(l):= part(l, 1+random(length(l)));
/* (%i1) random_element(['a, 'b, 'c]);
(%o1) c
*/

View file

@ -0,0 +1,3 @@
import Nanoquery.Util
list = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
println list[new(Random).getInt(len(list))]

View file

@ -0,0 +1,4 @@
;; from list containnig only literals and literal constants
user-message one-of [ 1 3 "rooster" blue ]
;; from list containing variables and reporters
user-message one-of (list (red + 2) turtles (patch 0 0) )

View file

@ -0,0 +1,13 @@
/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
iArray = [ 1, 2, 3, 4, 5 ] -- a traditional array
iList = Arrays.asList(iArray) -- a Java Collection "List" object
iWords = '1 2 3 4 5' -- a list as a string of space delimited words
v1 = iArray[Random().nextInt(iArray.length)]
v2 = iList.get(Random().nextInt(iList.size()))
v3 = iWords.word(Random().nextInt(iWords.words()) + 1) -- the index for word() starts at one
say v1 v2 v3

View file

@ -0,0 +1,2 @@
(define (pick-random-element R)
(nth (rand (length R)) R))

View file

@ -0,0 +1,5 @@
import random
randomize()
let ls = @["foo", "bar", "baz"]
echo sample(ls)

View file

@ -0,0 +1,3 @@
let list_rand lst =
let len = List.length lst in
List.nth lst (Random.int len)

View file

@ -0,0 +1,3 @@
let array_rand ary =
let len = Array.length ary in
ary.(Random.int len)

View file

@ -0,0 +1,2 @@
values := [1, 2, 3];
value := values[(Float->Random() * 100.0)->As(Int) % values->Size()];

View file

@ -0,0 +1,10 @@
package main
import "core:fmt"
import "core:math/rand"
main :: proc() {
list := []string{"foo", "bar", "baz"}
rand_index := rand.int_max(len(list))
fmt.println(list[rand_index])
}

View file

@ -0,0 +1 @@
: pickRand(l) l size rand l at ;

View file

@ -0,0 +1,4 @@
(import (otus random!))
(define x '("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"))
(print (list-ref x (rand! (length x))))

View file

@ -0,0 +1 @@
pick(v)=v[random(#v)+1]

View file

@ -0,0 +1,2 @@
$arr = array('foo', 'bar', 'baz');
$x = $arr[array_rand($arr)];

View file

@ -0,0 +1,3 @@
declare t(0:9) character (1) static initial
('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
put ( t(10*random()) );

View file

@ -0,0 +1,9 @@
Program PickRandomElement (output);
const
s: array [1..5] of string = ('1234', 'ABCDE', 'Charlie', 'XB56ds', 'lala');
begin
randomize;
writeln(s[low(s) + random(length(s))]);
end.

View file

@ -0,0 +1,2 @@
my @array = qw(a b c);
print $array[ rand @array ];

View file

@ -0,0 +1,5 @@
(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2.5</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"three"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">4</span><span style="color: #0000FF;">,{</span><span style="color: #008000;">"4 as well"</span><span style="color: #0000FF;">}}}</span>
<span style="color: #7060A8;">pp</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">rand</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">))])</span>
<!--

View file

@ -0,0 +1,19 @@
go =>
% single element
println(choice=choice(10)), % single element
% From a list of numbers
L = 1..10,
println([choice(L) : _ in 1..10]),
% From a string
S = "pickrandomelement",
println([choice(S) : _ in 1..10]),
nl.
% Pick a random number from 1..N
choice(N) = random(1,N), integer(N) => true.
% Pick a random element from a list L.
choice(List) = List[choice(List.length)], list(List) => true.

Some files were not shown because too many files have changed in this diff Show more