void operator()( sequence_space_type * seqs, FreeSpaceType & free_space, unsigned int N ) { assert( N <= free_space.free_size() ); sequence_distribution_type seq_gen( 0, seqs.row_count() - 1 ); typename FreeSpaceType::base_type::iterator it = free_space.free_begin(); while( N-- ) { unsigned int seq_idx = seq_gen( *m_rng ); typename FreeSpaceType::size_type all_idx = *it++; operator()( seqs, seq_idx, all_idx ); } }
static void mt_write(struct dhara_map *m, dhara_sector_t s, int seed) { const size_t page_size = 1 << m->journal.nand->log2_page_size; uint8_t buf[page_size]; dhara_error_t err; seq_gen(seed, buf, sizeof(buf)); if (dhara_map_write(m, s, buf, &err) < 0) dabort("map_write", err); }
void generate_child_mutations( sequence_space_type * off, mutation_pool_type * mut_pool, mutation_distribution_type * mut_dist, unsigned int N, typename free_space_type::base_type::iterator & it, typename free_space_type::base_type::iterator & end, unsigned int gen ) { // std::cerr << "Child population size: " << m_child->haploid_genome_count() << std::endl; // std::cerr << "Mutation count: " << N << std::endl; // std::cerr << "Free space: " << m_free_space.free_size() << std::endl; // resetMutationEvents( mut_pool, mut_dist, N, off->haploid_genome_count() + 1 ); // m_allele_space.alignNeutralToPopulation( off->getMaxBlocks() ); boost::random::uniform_int_distribution< unsigned int > seq_gen( 0, off->haploid_genome_count() - 1); unsigned int i = 0; while( i < N ) { typename free_space_type::size_type all_idx = m_allele_space.size(); if( it != end ) { all_idx = *it++; } else { m_allele_space.grow(); m_trait_space.grow(); } unsigned int seq_idx = seq_gen( *m_rand ); assert( all_idx < off->getMaxAlleles() ); mut_pool->at( i ) = all_idx; mut_dist->at( seq_idx + 1 ) += 1; allele_gen( m_allele_space, all_idx, gen ); trait_gen(*m_rand, m_trait_space, all_idx ); ++i; } // scan right to produce m_mut_pool relative index ranges for( unsigned int i = 2; i < mut_dist->size(); ++i ) { mut_dist->at( i ) += mut_dist->at( i - 1 ); } }
void main(void) { int seq[10]; int n; int i; char line[100]; printf("\nNon-Repeated Sequence of Three Chars. Generator"); printf("\n==============================================="); printf("\n\nSequence Length Please --> "); gets(line); n = atoi(line); printf("\nGenerated Sequence is shown below :\n"); seq_gen(seq, n); }