File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 11struct EventIdentifiers {
2- static let threatIdentifierList : [ Int ] = ( 1 ... 14 ) . map { _ in Int . random ( in: 100_000 ..< 999_999_999 ) }
3- static let raspExecutionStateIdentifierList : [ Int ] = ( 1 ... 1 ) . map { _ in Int . random ( in: 100_000 ..< 999_999_999 ) }
2+ static var generatedNumbers = RandomGenerator . generateRandomIdentifiers ( length: 19 )
43
54 // Channel identifiers for RN event emitter
6- static let threatChannelKey : String = String ( Int . random ( in: 100_000 ..< 999_999_999 ) )
7- static let threatChannelName : String = String ( Int . random ( in: 100_000 ..< 999_999_999 ) )
8- static let raspExecutionStateChannelKey : String = String ( Int . random ( in: 100_000 ..< 999_999_999 ) )
9- static let raspExecutionStateChannelName : String = String ( Int . random ( in: 100_000 ..< 999_999_999 ) )
5+ static let threatChannelKey : String = String ( generatedNumbers [ 0 ] )
6+ static let threatChannelName : String = String ( generatedNumbers [ 1 ] )
7+ static let raspExecutionStateChannelKey : String = String ( generatedNumbers [ 2 ] )
8+ static let raspExecutionStateChannelName : String = String ( generatedNumbers [ 3 ] )
9+
10+ static let raspExecutionStateIdentifierList : [ Int ] = [ generatedNumbers [ 4 ] ]
11+ static let threatIdentifierList : [ Int ] = generatedNumbers. suffix ( 14 )
12+
1013}
Original file line number Diff line number Diff line change 1+ internal class RandomGenerator {
2+
3+ internal static func generateRandomIdentifiers( length: Int ) -> [ Int ] {
4+ var generatedNumbers = Set < Int > ( )
5+
6+ while generatedNumbers. count < length {
7+ generatedNumbers. insert ( Int . random ( in: 10_000 ... 999_999_999 ) )
8+ }
9+
10+ return Array ( generatedNumbers)
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments