Created
June 2, 2025 12:58
-
-
Save jacobsapps/6b9159a034912c14ea3162a4fa02feb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func checkRarity(from imageEmbedding: [Float]) -> Rarity { | |
guard let first = imageEmbedding.first else { | |
return .common | |
} | |
let decimalString = String(format: "%.12f", first) | |
if let lastDigitChar = decimalString.last, | |
let digit = Int(String(lastDigitChar)) { | |
switch digit { | |
case 9: | |
return .secretRare | |
case 7...8: | |
return .ultraRare | |
case 4...6: | |
return .rare | |
default: | |
return .common | |
} | |
} else { | |
return .common | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment