We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3319

Summary: Getting the POSIX out of testqsort.c
Product: SDL Reporter: Simon Hug <chli.hug>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Windows (All)   
Attachments: Removes POSIX code out of testqsort.c

Description Simon Hug 2016-05-04 19:04:54 UTC
Created attachment 2441 [details]
Removes POSIX code out of testqsort.c

There's a call to the POSIX function random in test/testqsort.c. Naturally, Windows doesn't do that. The attached patch changes the call to the SDLtest framework random functions and adds some seed control.

Looking at SDLTest_RandomInitTime, I just want to say that 'srand((unsigned int)time(NULL)); a=rand(); srand(clock()); b=rand();' is an absolutely terrible way to initialize a seed on Windows because of its terrible LCG.
Comment 1 Sam Lantinga 2016-10-01 19:34:05 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/53980a18cdde

Also, agreed on the srand() comment, but I think it's sufficient for testing purposes.