Vocabulary/querydot

From J Wiki
Jump to: navigation, search

>> <<   Back to: Vocabulary Thru to: Dictionary

?. y Roll / fixed seed

Rank Infinity -- operates on x and y as a whole -- WHY IS THIS IMPORTANT?

x ?. y Deal / fixed seed

Rank 0 0 -- operates on individual atoms of x and y, producing a result that may require fill -- WHY IS THIS IMPORTANT?



Behaves like Roll/Deal (?) — except that the random-number generator (RNG) is reset each time ?. is executed.

This ensures that any two executions of ?. with the same arguments will produce the same sequence of random numbers

   (?.10) ; (?.10)
+-+-+
|6|6|
+-+-+
   ?. 10#100
46 55 79 52 54 39 60 57 60 94
   ?. 10#100
46 55 79 52 54 39 60 57 60 94

   3?.10
6 9 1
   3?.10
6 9 1

Common uses

Generate reproducible "random number" samples.

Run a reproducible Monte-Carlo simulation.


Related Primitives

Roll/Deal (?)


More Information

1. Executing ?. does not change the state of the RNG used by ? .

2. The rank of  ?.y is infinite, in contrast to  ?y which has rank 0. This is because re-executing (?.) on each atom would reset the RNG for each atom, with the result that all the results would be the same.


Details

1. (?.) uses RNG 1, GB_Flip.

2. Each execution of ?. resets the RNG using a seed of 16807 before generating results.


Use These Combinations

Combinations using  ?. y that have exceptionally good performance include:

What it does Type;

Precisions;
Ranks

Syntax Variants;

Restrictions

Benefits;

Bug Warnings

Arrays of random numbers x ?@$ y

x([: ? $)y

?. in place of ?

@: in place of @
# in place of $

does not create x $ y