/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */ /* $Id: vctRandomDynamicNArray.h,v 1.3 2007/04/26 19:33:58 anton Exp $ Author(s): Anton Deguet Created on: 2007-02-11 (C) Copyright 2007-2007 Johns Hopkins University (JHU), All Rights Reserved. --- begin cisst license - do not edit --- This software is provided "as is" under an open source license, with no warranty. The complete license can be found in license.txt and http://www.cisst.org/cisst/license.txt. --- end cisst license --- */ #ifndef _vctRandomDynamicNArray_h #define _vctRandomDynamicNArray_h #include #include #include #include /*! Define the global function vctRandom to initialize a dynamic NArray with random elements. The function takes a range from which to choose random elements. \note The function uses the global instance of cmnRandomSequence to extract random values. As we have a vague plan to allow for multiple random sequence objects to coexist, these interfaces may need to be changed. */ template void vctRandom(vctDynamicNArrayBase<_nArrayOwnerType, _elementType, _dimension> & nArray, const typename vctDynamicNArrayBase<_nArrayOwnerType, _elementType, _dimension>::value_type min, const typename vctDynamicNArrayBase<_nArrayOwnerType, _elementType, _dimension>::value_type max) { cmnRandomSequence & randomSequence = cmnRandomSequence::GetInstance(); typedef typename vctDynamicNArrayBase<_nArrayOwnerType, _elementType, _dimension>::iterator iterator; iterator iter; const iterator end = nArray.end(); for (iter = nArray.begin(); iter != end; iter++) { randomSequence.ExtractRandomValue(min, max, *iter); } } #endif // _vctRandomDynamicNArray_h // **************************************************************************** // Change History // **************************************************************************** // // $Log: vctRandomDynamicNArray.h,v $ // Revision 1.3 2007/04/26 19:33:58 anton // All files in libraries: Applied new license text, separate copyright and // updated dates, added standard header where missing. // // Revision 1.2 2007/03/08 04:29:25 anton // cisstVector NArray: Now templated by dimension (see #258). Added template // specialization for slices of dimension 1 NArray to return value_type. Used // Ofri's implementation of IncrementPointer() in loop engines (previous one did // not handle more than dimension 3). Also renamed DimSize, DimStride and // Dimension to size(d), stride(d), and dimensioni (for STL flavor). // // Revision 1.1 2007/02/12 03:23:37 anton // vctRandom: Split in multiple files to avoid too many inclusions and dependencies // (leads to longer compilation times, see #264). // // // ****************************************************************************