2222
2323import binary = require( '@stdlib/random/tools/binary' ) ;
2424import binaryFactory = require( '@stdlib/random/tools/binary-factory' ) ;
25+ import ternary = require( '@stdlib/random/tools/ternary' ) ;
26+ import ternaryFactory = require( '@stdlib/random/tools/ternary-factory' ) ;
2527import unary = require( '@stdlib/random/tools/unary' ) ;
2628import unaryFactory = require( '@stdlib/random/tools/unary-factory' ) ;
2729
@@ -53,7 +55,7 @@ interface Namespace {
5355 * 'order': 'row-major'
5456 * };
5557 *
56- * var rand = new Random ( uniform, [ idt, idt ], odt, policies, options );
58+ * var rand = new ns.binary ( uniform, [ idt, idt ], odt, policies, options );
5759 *
5860 * var v = rand.generate( [ 2, 2 ], 0.0, 1.0 );
5961 * // returns <ndarray>
@@ -73,7 +75,7 @@ interface Namespace {
7375 * 'order': 'row-major'
7476 * };
7577 *
76- * var rand = new Random ( uniform, [ idt, idt ], odt, policies, options );
78+ * var rand = new ns.binary ( uniform, [ idt, idt ], odt, policies, options );
7779 *
7880 * var out = ndzeros( [ 2, 2 ] );
7981 * var v = rand.assign( 0.0, 1.0, out );
@@ -145,6 +147,122 @@ interface Namespace {
145147 */
146148 binaryFactory : typeof binaryFactory ;
147149
150+ /**
151+ * Constructor for creating ndarrays filled with pseudorandom values drawn from a ternary PRNG.
152+ *
153+ * @param prng - ternary pseudorandom value generator
154+ * @param idtypes - list containing a list of supported input data types for each PRNG parameter
155+ * @param odtypes - list of supported output data types
156+ * @param policies - dispatch policies
157+ * @param options - function options
158+ * @returns instance
159+ *
160+ * @example
161+ * var dtypes = require( '@stdlib/ndarray/dtypes' );
162+ * var frechet = require( '@stdlib/random/base/frechet' );
163+ *
164+ * var idt = dtypes( 'real_and_generic' );
165+ * var odt = dtypes( 'real_floating_point_and_generic' );
166+ *
167+ * var policies = {
168+ * 'output': 'real_floating_point_and_generic'
169+ * };
170+ * var options = {
171+ * 'order': 'row-major'
172+ * };
173+ *
174+ * var rand = new ns.ternary( frechet, [ idt, idt, idt ], odt, policies, options );
175+ *
176+ * var v = rand.generate( [ 2, 2 ], 2.0, 3.0, 0.0 );
177+ * // returns <ndarray>
178+ *
179+ * @example
180+ * var dtypes = require( '@stdlib/ndarray/dtypes' );
181+ * var ndzeros = require( '@stdlib/ndarray/zeros' );
182+ * var frechet = require( '@stdlib/random/base/frechet' );
183+ *
184+ * var idt = dtypes( 'real_and_generic' );
185+ * var odt = dtypes( 'real_floating_point_and_generic' );
186+ *
187+ * var policies = {
188+ * 'output': 'real_floating_point_and_generic'
189+ * };
190+ * var options = {
191+ * 'order': 'row-major'
192+ * };
193+ *
194+ * var rand = new ns.ternary( frechet, [ idt, idt, idt ], odt, policies, options );
195+ *
196+ * var out = ndzeros( [ 2, 2 ] );
197+ * var v = rand.assign( 2.0, 3.0, 0.0, out );
198+ * // returns <ndarray>
199+ *
200+ * var bool = ( v === out );
201+ * // returns true
202+ */
203+ ternary : typeof ternary ;
204+
205+ /**
206+ * Returns a function for generating pseudorandom values drawn from a ternary PRNG.
207+ *
208+ * @param prng - ternary pseudorandom value generator
209+ * @param idtypes - list containing a list of supported input data types for each PRNG parameter
210+ * @param odtypes - list of supported output data types
211+ * @param policies - dispatch policies
212+ * @param options - function options
213+ * @returns instance
214+ *
215+ * @example
216+ * var dtypes = require( '@stdlib/ndarray/dtypes' );
217+ * var frechet = require( '@stdlib/random/base/frechet' );
218+ *
219+ * var idt = dtypes( 'real_and_generic' );
220+ * var odt = dtypes( 'real_floating_point_and_generic' );
221+ *
222+ * var policies = {
223+ * 'output': 'real_floating_point_and_generic'
224+ * };
225+ * var options = {
226+ * 'order': 'row-major'
227+ * };
228+ *
229+ * var factory = ns.ternaryFactory( frechet, [ idt, idt, idt ], odt, policies, options );
230+ *
231+ * var rand = factory();
232+ * // returns <Function>
233+ *
234+ * var v = rand( [ 2, 2 ], 2.0, 3.0, 0.0 );
235+ * // returns <ndarray>
236+ *
237+ * @example
238+ * var dtypes = require( '@stdlib/ndarray/dtypes' );
239+ * var ndzeros = require( '@stdlib/ndarray/zeros' );
240+ * var frechet = require( '@stdlib/random/base/frechet' );
241+ *
242+ * var idt = dtypes( 'real_and_generic' );
243+ * var odt = dtypes( 'real_floating_point_and_generic' );
244+ *
245+ * var policies = {
246+ * 'output': 'real_floating_point_and_generic'
247+ * };
248+ * var options = {
249+ * 'order': 'row-major'
250+ * };
251+ *
252+ * var factory = ns.ternaryFactory( frechet, [ idt, idt, idt ], odt, policies, options );
253+ *
254+ * var rand = factory();
255+ * // returns <Function>
256+ *
257+ * var out = ndzeros( [ 2, 2 ] );
258+ * var v = rand.assign( 2.0, 3.0, 0.0, out );
259+ * // returns <ndarray>
260+ *
261+ * var bool = ( v === out );
262+ * // returns true
263+ */
264+ ternaryFactory : typeof ternaryFactory ;
265+
148266 /**
149267 * Constructor for creating ndarrays filled with pseudorandom values drawn from a unary PRNG.
150268 *
@@ -169,7 +287,7 @@ interface Namespace {
169287 * 'order': 'row-major'
170288 * };
171289 *
172- * var rand = new Random ( exponential, idt, odt, policies, options );
290+ * var rand = new ns.unary ( exponential, idt, odt, policies, options );
173291 *
174292 * var v = rand.generate( [ 2, 2 ], 2.0 );
175293 * // returns <ndarray>
@@ -189,7 +307,7 @@ interface Namespace {
189307 * 'order': 'row-major'
190308 * };
191309 *
192- * var rand = new Random ( exponential, idt, odt, policies, options );
310+ * var rand = new ns.unary ( exponential, idt, odt, policies, options );
193311 *
194312 * var out = ndzeros( [ 2, 2 ] );
195313 * var v = rand.assign( 2.0, out );
0 commit comments