Skip to content

Random Values

image Source: adopted from here

Introduction

Any programming language support random number generation, which is required in a Monte Carlo experiment. Arguably, the digits of \pi are good approximates.

Question

Create a table with random values compliant with the following schema:

c       | t f a
--------| -----
timespan| n
long    | j
float   | f
symbol  | s 

Answer

t:([] timespan:10?0D;long:10?til 1000;float:rand each 10#3.14f;symbol:10?`3);

Explanations:

  • 10?0D: generate 10 random timespan.
  • 10?`3: generate 10 random symbols and each one has three characters.