DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

random(3C++)


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(3C++), Block(3C++), drand48(3C)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004