Commit 05e2413d authored by David Schleef's avatar David Schleef

plugins/elements/gstfakesrc.c: Use g_random_int_range(), since it produces...

plugins/elements/gstfakesrc.c: Use g_random_int_range(), since it produces better random numbers in a range than almo...

Original commit message from CVS:
* plugins/elements/gstfakesrc.c:
Use g_random_int_range(), since it produces better random
numbers in a range than almost-correct floating point code.
parent c9fbb589
2006-12-21 David Schleef <ds@schleef.org>
* plugins/elements/gstfakesrc.c:
Use g_random_int_range(), since it produces better random
numbers in a range than almost-correct floating point code.
2006-12-21 Stefan Kost <ensonic@users.sf.net>
* libs/gst/check/gstcheck.c: (gst_check_setup_src_pad),
......
......@@ -596,7 +596,7 @@ gst_fake_src_prepare_buffer (GstFakeSrc * src, GstBuffer * buf)
guint8 *ptr = GST_BUFFER_DATA (buf);
for (i = GST_BUFFER_SIZE (buf); i; i--) {
*ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX));
*ptr++ = g_random_int_range (0, 256);
}
break;
}
......@@ -660,10 +660,7 @@ gst_fake_src_get_size (GstFakeSrc * src)
size = src->sizemax;
break;
case FAKE_SRC_SIZETYPE_RANDOM:
size =
src->sizemin +
(guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX +
(gfloat) src->sizemin));
size = g_random_int_range (src->sizemin, src->sizemax);
break;
case FAKE_SRC_SIZETYPE_EMPTY:
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment