本文整理汇总了C++中Rand::set_seed方法的典型用法代码示例。如果您正苦于以下问题:C++ Rand::set_seed方法的具体用法?C++ Rand::set_seed怎么用?C++ Rand::set_seed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rand
的用法示例。
在下文中一共展示了Rand::set_seed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
void DaemonState::start(bool forceFullScan, bool isReindex)
{
// Disable implicit flushing after a change
WorkerThread::immediateFlush(false);
// Do full scans ?
if (forceFullScan == true)
{
m_fullScan = true;
}
else
{
Rand randomStuff;
guint32 randomArray[5];
randomStuff.set_seed(randomArray[2]);
gint32 randomNum = randomStuff.get_int_range(0, 10);
if (randomNum >= 7)
{
m_fullScan = true;
}
#ifdef DEBUG
cout << "DaemonState::start: picked " << randomNum << endl;
#endif
}
m_isReindex = isReindex;
// Fire up the disk monitor thread
if (m_pDiskHandler == NULL)
{
OnDiskHandler *pDiskHandler = new OnDiskHandler();
pDiskHandler->getFileFoundSignal().connect(sigc::mem_fun(*this, &DaemonState::on_message_filefound));
m_pDiskHandler = pDiskHandler;
}
MonitorThread *pDiskMonitorThread = new MonitorThread(m_pDiskMonitor, m_pDiskHandler);
start_thread(pDiskMonitorThread, true);
for (set<PinotSettings::IndexableLocation>::const_iterator locationIter = PinotSettings::getInstance().m_indexableLocations.begin();
locationIter != PinotSettings::getInstance().m_indexableLocations.end(); ++locationIter)
{
m_crawlQueue.push(*locationIter);
}
#ifdef DEBUG
cout << "DaemonState::start: " << m_crawlQueue.size() << " locations to crawl" << endl;
#endif
if (m_fullScan == true)
{
CrawlHistory crawlHistory(PinotSettings::getInstance().getHistoryDatabaseName());
// Update all items status so that we can get rid of files from deleted sources
crawlHistory.updateItemsStatus(CrawlHistory::CRAWLING, CrawlHistory::TO_CRAWL, 0, true);
crawlHistory.updateItemsStatus(CrawlHistory::CRAWLED, CrawlHistory::TO_CRAWL, 0, true);
crawlHistory.updateItemsStatus(CrawlHistory::CRAWL_ERROR, CrawlHistory::TO_CRAWL, 0, true);
}
// Initiate crawling
start_crawling();
}
示例2: start
void DaemonState::start(bool forceFullScan)
{
// Disable implicit flushing after a change
WorkerThread::immediateFlush(false);
// Do full scans ?
if (forceFullScan == true)
{
m_fullScan = true;
}
else
{
Rand randomStuff;
guint32 randomArray[5];
randomStuff.set_seed(randomArray[2]);
int randomNum = randomStuff.get_int_range(0, 10);
if (randomNum >= 7)
{
m_fullScan = true;
}
#ifdef DEBUG
cout << "DaemonState::start: picked " << randomNum << endl;
#endif
}
// Fire up the mail monitor thread now
m_pMailHandler = new MboxHandler();
MonitorThread *pMailMonitorThread = new MonitorThread(m_pMailMonitor, m_pMailHandler);
pMailMonitorThread->getDirectoryFoundSignal().connect(SigC::slot(*this, &DaemonState::on_message_filefound));
start_thread(pMailMonitorThread, true);
// Same for the disk monitor thread
m_pDiskHandler = new OnDiskHandler();
MonitorThread *pDiskMonitorThread = new MonitorThread(m_pDiskMonitor, m_pDiskHandler);
pDiskMonitorThread->getDirectoryFoundSignal().connect(SigC::slot(*this, &DaemonState::on_message_filefound));
start_thread(pDiskMonitorThread, true);
set<PinotSettings::IndexableLocation>::const_iterator locationIter = PinotSettings::getInstance().m_indexableLocations.begin();
if (locationIter != PinotSettings::getInstance().m_indexableLocations.end())
{
// Crawl this now
crawlLocation(locationIter->m_name, true, locationIter->m_monitor);
}
}