/* * Copyright ©2021 Chris Thachuk. All rights reserved. Permission is * hereby granted to students registered for University of Washington * CSE 333 for use solely during Autumn Quarter 2021 for purposes of * the course. No other use, copying, distribution, or modification * is permitted without prior written consent. Copyrights for * third-party components of this work must be honored. Instructors * interested in reusing these course materials should contact the * author. */ #include "dnautil.h" #include #include namespace dnautil { // Private functions // Returns an oligo with a random base sequence. Oligo RandomOligo(std::mt19937 &rng) { std::uniform_int_distribution dist(0,3); Oligo o; for(int i = 0; i < kOligoLength; ++i) { Base b = static_cast(dist(rng)); o.bases[i] = b; } return o; } // Public functions OligoPool RandomOligoPool(int size) { OligoPool pool; if (size > 0) { pool.reserve(size); std::random_device dev; std::mt19937 rng(dev()); for(int i = 0; i < size; ++i) { pool.push_back(RandomOligo(rng)); } } return pool; } } // namespace dnautil