mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
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.
This commit is contained in:
parent
c9fbb589a0
commit
05e2413d3e
2 changed files with 8 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue