fn pick_card(&mut self) {
        // Determine if the card should be picked from the new queue or from the due cards.
        let new = if self.new_queue.is_empty() {
            // There are no new cards to be introduced.
            false
        } else if self.due == 0 || self.prefer_new {
            // There are no due cards, or new cards are preferred.
            true
        // Randomly choose between the new queue or the due cards. The ratio is chosen such
        // that the space between new cards is as wide as possible, unless the probability is too
        // small.
        } else {
            // Saturate at lower bound for probability.
            rand::thread_rng().gen_bool(self.deck.settings.min_new_probability.max(
                self.new_queue.len() as f64 / (self.due as f64 + self.new_queue.len() as f64)
            ))
        };

        if new {
            // TODO: It is likely better to pop from the other end such that the earliest
            //       introduced cards gets into play even if the new queue piles up.
            // Simply pop from the new queue (possibly yielding `None`). We can safely unwrap here,
            // since `new` is false when `self.new_queue` is empty.
            self.current_card = self.new_queue.pop().unwrap();
        } else {
            // Take out the next card from the queue. We can safely unwrap, since it is assumed
            // that `self.queue` is nonempty.
            let (&time, &card) = self.queue.iter().next().unwrap();
            self.queue.remove(&time);
            // Update.
            self.current_card = card;
            if self.due != 0 {
                self.due -= 1;
            }
        }
    }
/// Pick out a new card without rescheduling the current card.
///
/// `self.current_card` ought to have been rescheduled when this method is called. Otherwise,
/// the card will be orphaned and not get into the schedule again. In other words, this is
/// called either in the start of the scheduler or after rescheduling of the current card has
/// been handled.
///
/// This decrements `self.due` if the card is chosen from the schedule.
Pick out a new card without rescheduling the current card.
`self.current_card` ought to have been rescheduled when this method is called. Otherwise,
the card will be orphaned and not get into the schedule again. In other words, this is
called either in the start of the scheduler or after rescheduling of the current card has
been handled.

This decrements `self.due` if the card is chosen from the schedule.
Pick out a new card without rescheduling the current card . ` self . current_card ` ought to have been rescheduled when this method is called . Otherwise the card will be orphaned and not get into the schedule again . In other words this is called either in the start of the scheduler or after rescheduling of the current card has been handled . This decrements ` self . due ` if the card is chosen from the schedule .
fn pick_card(&mut self) {
        // Determine if the card should be picked from the new queue or from the due cards.
        let new = if self.new_queue.is_empty() {
            // There are no new cards to be introduced.
            false
        } else if self.due == 0 || self.prefer_new {
            // There are no due cards, or new cards are preferred.
            true
        // Randomly choose between the new queue or the due cards. The ratio is chosen such
        // that the space between new cards is as wide as possible, unless the probability is too
        // small.
        } else {
            // Saturate at lower bound for probability.
            rand::thread_rng().gen_bool(self.deck.settings.min_new_probability.max(
                self.new_queue.len() as f64 / (self.due as f64 + self.new_queue.len() as f64)
            ))
        };
        if new {
            // TODO: It is likely better to pop from the other end such that the earliest
            //       introduced cards gets into play even if the new queue piles up.
            // Simply pop from the new queue (possibly yielding `None`). We can safely unwrap here,
            // since `new` is false when `self.new_queue` is empty.
            self.current_card = self.new_queue.pop().unwrap();
        } else {
            // Take out the next card from the queue. We can safely unwrap, since it is assumed
            // that `self.queue` is nonempty.
            let (&time, &card) = self.queue.iter().next().unwrap();
            self.queue.remove(&time);
            // Update.
            self.current_card = card;
            if self.due != 0 {
                self.due -= 1;
            }
        }
    }
fn pick_card ( & mut self ) { // Determine if the card should be picked from the new queue or from the due cards. let new = if self . new_queue . is_empty ( ) { // There are no new cards to be introduced. false } else if self . due == 0 || self . prefer_new { // There are no due cards, or new cards are preferred. true // Randomly choose between the new queue or the due cards. The ratio is chosen such // that the space between new cards is as wide as possible, unless the probability is too // small. } else { // Saturate at lower bound for probability. rand :: thread_rng ( ) . gen_bool ( self . deck . settings . min_new_probability . max ( self . new_queue . len ( ) as f64 / ( self . due as f64 + self . new_queue . len ( ) as f64 ) ) ) } ; if new { // TODO: It is likely better to pop from the other end such that the earliest //       introduced cards gets into play even if the new queue piles up. // Simply pop from the new queue (possibly yielding `None`). We can safely unwrap here, // since `new` is false when `self.new_queue` is empty. self . current_card = self . new_queue . pop ( ) . unwrap ( ) ; } else { // Take out the next card from the queue. We can safely unwrap, since it is assumed // that `self.queue` is nonempty. let ( & time , & card ) = self . queue . iter ( ) . next ( ) . unwrap ( ) ; self . queue . remove ( & time ) ; // Update. self . current_card = card ; if self . due != 0 { self . due -= 1 ; } } }
Pick out a new card without rescheduling the current card.
Pick out a new card without rescheduling the current card .
&mut self
&mut self