Skip to content

Commit

Permalink
g_random_int_range is a Glib function not Glibc
Browse files Browse the repository at this point in the history
random() supposedly uses /dev/random on Linux now.
  • Loading branch information
mxcl committed Dec 2, 2015
1 parent 1996583 commit 6bd573a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Fisher-Yates_Shuffle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public extension MutableCollectionType where Index == Int {

for i in 0..<count - 1 {
#if os(Linux)
let j = Int(g_random_int_range(0, Int32(count - i))) + i
let j = Int(random() % (count - i)) + i
#else
let j = Int(arc4random_uniform(UInt32(count - i))) + i
#endif
Expand Down

0 comments on commit 6bd573a

Please sign in to comment.