/* Copyright (C) 2010 Vincent Penquerc'h. This file is part of the Kate codec library. Written by Vincent Penquerc'h. Use, distribution and reproduction of this library is governed by a BSD style source license included with this source in the file 'COPYING'. Please read these terms before distributing. */ #include #include #include #include static int get_random(int n) { return (rand()>>8)%n; } static int time_total_centiseconds(float t) { return (int)(t*100.0f+0.5f); } static int time_minutes(float t) { return time_total_centiseconds(t)/(60*100); } static int time_seconds(float t) { return time_total_centiseconds(t)/100%60; } static int time_centiseconds(float t) { return time_total_centiseconds(t)%100; } static void gen_time(float *t,float dt) { float r=*t+(rand()/(float)RAND_MAX)*dt; *t+=dt; printf("[%d:%02d.%02d]",time_minutes(r),time_seconds(r),time_centiseconds(r)); } static void gen_text() { int n,nchars=1+get_random(128); for (n=0;n