Mercurial > octave
comparison src/DLD-FUNCTIONS/rand.cc @ 5798:7e7ed81f5566
[project @ 2006-05-09 17:24:33 by jwe]
author | jwe |
---|---|
date | Tue, 09 May 2006 17:24:34 +0000 |
parents | 96cd81ed579e |
children | 0b190c343471 |
comparison
equal
deleted
inserted
replaced
5797:11fcab4c461d | 5798:7e7ed81f5566 |
---|---|
327 @end example\n\ | 327 @end example\n\ |
328 \n\ | 328 \n\ |
329 @noindent\n\ | 329 @noindent\n\ |
330 You may also initialize the state vector from an arbitrary vector of\n\ | 330 You may also initialize the state vector from an arbitrary vector of\n\ |
331 length <= 625 for @var{v}. This new state will be a hash based on the\n\ | 331 length <= 625 for @var{v}. This new state will be a hash based on the\n\ |
332 the value of @var{v}, not @var{v} itself.\n\ | 332 value of @var{v}, not @var{v} itself.\n\ |
333 \n\ | 333 \n\ |
334 By default, the generator is initialized from @code{/dev/urandom} if it is\n\ | 334 By default, the generator is initialized from @code{/dev/urandom} if it is\n\ |
335 available, otherwise from cpu time, wall clock time and the current\n\ | 335 available, otherwise from cpu time, wall clock time and the current\n\ |
336 fraction of a second.\n\ | 336 fraction of a second.\n\ |
337 \n\ | 337 \n\ |
343 Do NOT use for CRYPTOGRAPHY without securely hashing several returned\n\ | 343 Do NOT use for CRYPTOGRAPHY without securely hashing several returned\n\ |
344 values together, otherwise the generator state can be learned after\n\ | 344 values together, otherwise the generator state can be learned after\n\ |
345 reading 624 consecutive values.\n\ | 345 reading 624 consecutive values.\n\ |
346 \n\ | 346 \n\ |
347 @code{rand} includes a second random number generator, that was the\n\ | 347 @code{rand} includes a second random number generator, that was the\n\ |
348 previous generator used in octave. The new generator is used by default\n\ | 348 previous generator used in Octave. The new generator is used by default\n\ |
349 as it is significantly faster than the old generator, and produces\n\ | 349 as it is significantly faster than the old generator, and produces\n\ |
350 random numebrs with a significantly longer cycle time. However, in\n\ | 350 random numbers with a significantly longer cycle time. However, in\n\ |
351 some circumstances it might be desireable to obtain the same random\n\ | 351 some circumstances it might be desirable to obtain the same random\n\ |
352 sequences as used by the old generators. To do this the keyword\n\ | 352 sequences as used by the old generators. To do this the keyword\n\ |
353 \"seed\" is used to specify that the old generators should be use,\n\ | 353 \"seed\" is used to specify that the old generators should be use,\n\ |
354 as in\n\ | 354 as in\n\ |
355 \n\ | 355 \n\ |
356 @example\n\ | 356 @example\n\ |
366 \n\ | 366 \n\ |
367 However, it should be noted that querying the seed will not cause\n\ | 367 However, it should be noted that querying the seed will not cause\n\ |
368 @code{rand} to use the old generators, only setting the seed will.\n\ | 368 @code{rand} to use the old generators, only setting the seed will.\n\ |
369 To cause @code{rand} to once again use the new generators, the\n\ | 369 To cause @code{rand} to once again use the new generators, the\n\ |
370 keyword \"state\" should be used to reset the state of the @code{rand}.\n\ | 370 keyword \"state\" should be used to reset the state of the @code{rand}.\n\ |
371 @seealso{randn,rande,randg,randp}\n\ | 371 @seealso{randn, rande, randg, randp}\n\ |
372 @end deftypefn") | 372 @end deftypefn") |
373 { | 373 { |
374 octave_value retval; | 374 octave_value retval; |
375 | 375 |
376 int nargin = args.length (); | 376 int nargin = args.length (); |