greenplumn CRandom 源码

  • 2022-08-18
  • 浏览 (253)

greenplumn CRandom 代码

文件路径:/src/backend/gporca/libgpos/src/common/CRandom.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2008 Greenplum, Inc.
//
//	@filename:
//		CRandom.cpp
//
//	@doc:
//		Random number generator.
//
//	@owner:
//		Siva
//
//	@test:
//
//
//---------------------------------------------------------------------------

#include "gpos/common/CRandom.h"

#include "gpos/base.h"
#include "gpos/common/clibwrapper.h"

#define DEFAULT_SEED 102

using namespace gpos;

CRandom::CRandom() : m_seed(DEFAULT_SEED)
{
}


CRandom::CRandom(ULONG seed) : m_seed(seed)
{
}

//---------------------------------------------------------------------------
//	@function:
//		CRandom::Next
//
//	@doc:
//		Returns next random number in the range 0 - 2^32
//
//---------------------------------------------------------------------------

ULONG
CRandom::Next()
{
	return clib::Rand(&m_seed);
}

CRandom::~CRandom() = default;

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoTimer 源码

greenplumn CBitSet 源码

greenplumn CBitSetIter 源码

greenplumn CBitVector 源码

greenplumn CDebugCounter 源码

greenplumn CHeapObject 源码

greenplumn CMainArgs 源码

greenplumn CRefCount 源码

greenplumn CStackDescriptor 源码

greenplumn CStackObject 源码

0  赞