Multiplatform.swift 602 B

1234567891011121314151617181920212223
  1. //
  2. // Multiplatform.swift
  3. // CryptoSwift
  4. //
  5. // Created by Marcin Krzyzanowski on 03/12/15.
  6. // Copyright © 2015 Marcin Krzyzanowski. All rights reserved.
  7. //
  8. #if os(Linux) || os(Android)
  9. import Glibc
  10. import SwiftShims
  11. #else
  12. import Darwin
  13. #endif
  14. @available(*, deprecated: 0.6.1, message: "Please don't use it. Use random generator suitable for the platform.")
  15. func cs_arc4random_uniform(_ upperBound: UInt32) -> UInt32 {
  16. #if os(Linux) || os(Android)
  17. return _swift_stdlib_cxx11_mt19937_uniform(upperBound)
  18. #else
  19. return arc4random_uniform(upperBound)
  20. #endif
  21. }