Best shuffle: Difference between revisions
m
no edit summary
m (Edited examples) |
mNo edit summary |
||
Line 2,004:
local fn ShuffleString( string as CFStringRef ) as CFStringRef
NSInteger i
Line 2,016 ⟶ 2,015:
local fn StringDifferences( string1 as CFStringRef, string2 as CFStringRef ) as NSInteger
▲NSInteger i, unchangePosition = 0
if fn StringLength( string1 ) != fn StringLength( string2 ) then NSLog( @"Strings must be of equal length." ) : exit fn
Line 2,024 ⟶ 2,022:
CFStringRef tempStr1 = fn StringSubstringWithRange( string1, fn CFRangeMake( i, 1 ) )
CFStringRef tempStr2 = fn StringSubstringWithRange( string2, fn CFRangeMake( i, 1 ) )
if fn StringIsEqual( tempStr1, tempStr2 ) == YES then
next
end fn =
NSInteger i, j, count
Line 2,046 ⟶ 2,044:
HandleEvents
</lang>
Output with four shuffles:
<pre>
abracadabra, caaarrdabab, (4)
|