Mercurial > octave
comparison src/DLD-FUNCTIONS/rand.cc @ 3369:f37ca3017116
[project @ 1999-11-21 16:26:02 by jwe]
author | jwe |
---|---|
date | Sun, 21 Nov 1999 16:26:08 +0000 |
parents | 2efa28a91e7a |
children | b80bbb43a1a9 |
comparison
equal
deleted
inserted
replaced
3368:a4cd1e9d9962 | 3369:f37ca3017116 |
---|---|
329 | 329 |
330 return retval; | 330 return retval; |
331 } | 331 } |
332 | 332 |
333 DEFUN_DLD (rand, args, nargout, | 333 DEFUN_DLD (rand, args, nargout, |
334 "rand -- generate a random value from a uniform distribution\n\ | 334 "-*- texinfo -*-\n\ |
335 \n\ | 335 @deftypefn {Loadable Function} {} rand (@var{x})\n\ |
336 rand (N) -- generate N x N matrix\n\ | 336 @deftypefnx {Loadable Function} {} rand (@var{n}, @var{m})\n\ |
337 rand (size (A)) -- generate matrix the size of A\n\ | 337 @deftypefnx {Loadable Function} {} rand (@code{\"seed\"}, @var{x})\n\ |
338 rand (N, M) -- generate N x M matrix\n\ | 338 Return a matrix with random elements uniformly distributed on the\n\ |
339 rand (\"seed\") -- get current seed\n\ | 339 interval (0, 1). The arguments are handled the same as the arguments\n\ |
340 rand (\"seed\", N) -- set seed\n\ | 340 for @code{eye}. In\n\ |
341 \n\ | 341 addition, you can set the seed for the random number generator using the\n\ |
342 See also: randn") | 342 form\n\ |
343 \n\ | |
344 @example\n\ | |
345 rand (\"seed\", @var{x})\n\ | |
346 @end example\n\ | |
347 \n\ | |
348 @noindent\n\ | |
349 where @var{x} is a scalar value. If called as\n\ | |
350 \n\ | |
351 @example\n\ | |
352 rand (\"seed\")\n\ | |
353 @end example\n\ | |
354 \n\ | |
355 @noindent\n\ | |
356 @code{rand} returns the current value of the seed.\n\ | |
357 @end deftypefn") | |
343 { | 358 { |
344 octave_value_list retval; | 359 octave_value_list retval; |
345 | 360 |
346 int nargin = args.length (); | 361 int nargin = args.length (); |
347 | 362 |
363 { | 378 { |
364 F77_XFCN (setcgn, SETCGN, (current_distribution)); | 379 F77_XFCN (setcgn, SETCGN, (current_distribution)); |
365 } | 380 } |
366 | 381 |
367 DEFUN_DLD (randn, args, nargout, | 382 DEFUN_DLD (randn, args, nargout, |
368 "randn -- generate a random value from a normal distribution\n\ | 383 "-*- texinfo -*-\n\ |
369 \n\ | 384 @deftypefn {Loadable Function} {} randn (@var{x})\n\ |
370 randn (N) -- generate N x N matrix\n\ | 385 @deftypefnx {Loadable Function} {} randn (@var{n}, @var{m})\n\ |
371 randn (size (A)) -- generate matrix the size of A\n\ | 386 @deftypefnx {Loadable Function} {} randn (@code{\"seed\"}, @var{x})\n\ |
372 randn (N, M) -- generate N x M matrix\n\ | 387 Return a matrix with normally distributed random elements. The\n\ |
373 randn (\"seed\") -- get current seed\n\ | 388 arguments are handled the same as the arguments for @code{eye}. In\n\ |
374 randn (\"seed\", N) -- set seed\n\ | 389 addition, you can set the seed for the random number generator using the\n\ |
375 \n\ | 390 form\n\ |
376 See also: rand") | 391 \n\ |
392 @example\n\ | |
393 randn (\"seed\", @var{x})\n\ | |
394 @end example\n\ | |
395 \n\ | |
396 @noindent\n\ | |
397 where @var{x} is a scalar value. If called as\n\ | |
398 \n\ | |
399 @example\n\ | |
400 randn (\"seed\")\n\ | |
401 @end example\n\ | |
402 \n\ | |
403 @noindent\n\ | |
404 @code{randn} returns the current value of the seed.\n\ | |
405 @end deftypefn") | |
377 { | 406 { |
378 octave_value_list retval; | 407 octave_value_list retval; |
379 | 408 |
380 int nargin = args.length (); | 409 int nargin = args.length (); |
381 | 410 |