for(int i=0; i<num_openbooks; i++){
Open_Book ob = customer.getOpen_books().get(i);
Book b = ob.getBook();
int pages_read = randint(60);
int this_page = randint(5)+1;
Chapter c = b.getChapters().get(0);
while(this_page < pages_read){
if(b.getExcluded_chapters().contains(c)) break;
if(this_page > pages_read)break;
if(this_page <= c.getEnd_page()){
if(!ob.getChapters_viewed().contains(c)){
ob.getChapters_viewed().add(c);
}
Page page = new Page();
page.setNumber(this_page);
this_page += 1;
ob.getPages().add(page);
}
if(this_page > c.getEnd_page()){
for(Chapter n : b.getChapters()){
if(n.getBegin_page()<this_page && n.getEnd_page()>= this_page){
c = n;
break;
}