DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

random(C++)


random -- generate a random location in an array

Synopsis

   template <class T>
   const T* random(const T* b,const T* e);

Assumptions

None.

Description

Returns a uniformly distributed random pointer into the array. If b>=e, the function returns 0.

Complexity

O(1).

Notes

Uses drand48(3C) to obtain a pseudo-random number.

Because a Block (see Block(3C++)) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together.

References

Array_alg(C++), Block(C++), drand48(S)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005