Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
9043985c
Commit
9043985c
authored
Sep 29, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some issues with dithering.
parent
6cf6f3f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
miniaudio.h
miniaudio.h
+14
-6
No files found.
miniaudio.h
View file @
9043985c
...
...
@@ -4232,7 +4232,7 @@ for miniaudio's purposes.
#define MA_LCG_M 2147483647
#define MA_LCG_A 48271
#define MA_LCG_C 0
static ma_int32 g_maLCG
;
static ma_int32 g_maLCG
= 4321; /* Non-zero initial seed. Use ma_seed() to use an explicit seed. */
void ma_seed(ma_int32 seed)
{
...
...
@@ -4247,9 +4247,14 @@ ma_int32 ma_rand_s32()
return r;
}
ma_uint32 ma_rand_u32()
{
return (ma_uint32)ma_rand_s32();
}
double ma_rand_f64()
{
return
(ma_rand_s32() + 0x80000000
) / (double)0x7FFFFFFF;
return
ma_rand_s32(
) / (double)0x7FFFFFFF;
}
float ma_rand_f32()
...
...
@@ -4257,15 +4262,18 @@ float ma_rand_f32()
return (float)ma_rand_f64();
}
static MA_INLINE
float ma_rand_range_f32(float lo, float hi)
float ma_rand_range_f32(float lo, float hi)
{
return ma_scale_to_range_f32(ma_rand_f32(), lo, hi);
}
static MA_INLINE
ma_int32 ma_rand_range_s32(ma_int32 lo, ma_int32 hi)
ma_int32 ma_rand_range_s32(ma_int32 lo, ma_int32 hi)
{
double x = ma_rand_f64();
return lo + (ma_int32)(x*(hi-lo));
if (lo == hi) {
return lo;
}
return lo + ma_rand_u32() / (0xFFFFFFFF / (hi - lo + 1) + 1);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment