Hello
I want to write function that initialize dynamic_bitset with radom bits.
Can sombody help me ?
3 replies to this topic
#1
Posted 21 December 2010 - 05:00 AM
|
|
|
#2
Posted 21 December 2010 - 05:14 AM
I write such code but it;s very slow:
void Chromosom::makeRandom()
{
bool r = 0;
for( int i = 0 ;i < chromSet.size() ;i++ )
{
r = rand() % 2;
if (r)
chromSet[i] = 1;
else
chromSet[i] = 0;
}
}
#3
Posted 21 December 2010 - 05:15 AM
Where:
boost::dynamic_bitset<> chromSet;
boost::dynamic_bitset<> chromSet;
#4
Posted 21 December 2010 - 10:45 AM
A conclusion is where you got tired of thinking.
#define class struct // All is public.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









