1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     test_Util.cpp
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #include <nn/types.h>
17 #include <cstdarg>
18 #include <cstdio>
19 #include <algorithm>
20 
21 namespace nn{ namespace test{
22 
23 void
FillBytesRandom(u8 * pBuffer,size_t len)24 FillBytesRandom(u8* pBuffer, size_t len)
25 {
26     while( len > 0 )
27     {
28         int data = ::std::rand();
29 
30         size_t copyLen = ::std::min(sizeof(data), len);
31         ::std::memcpy(pBuffer, &data, copyLen);
32         len -= copyLen;
33         pBuffer += copyLen;
34     }
35 }
36 
37 }}  // namespace nn::test
38 
39