Month: May 2019

Swift: How to use an Array to Randomly Select a String

If you wish to make an app that randomly selects a word or a phrase, then you'll need to use an array.  An array is a group of strings, numbers, or anything else.

Such as:

let array = ["Heads","Tails"]

Since we want to randomly select a word from this array, we need to use the arc4random statement, like so:

let randomIndex = Int(arc4random_uniform(UInt32(array.count)))

Then finally we want to print the results:

print(array[randomIndex])

Now lets put the above altogether in code:

import UIKit
import Foundation

let array = ["Heads","Tails"]
let randomIndex = Int(arc4random_uniform(UInt32(array.count)))
print(array[randomIndex])

 

 

 

Heads of NASA and NOAA warns that 5G could mean less time to flee deadly Hurricanes

“It’s become increasingly clear that the wireless industry is trying to push the idea of speedy 5G wireless networks before the technology is actually ready,” Sean Hollister reports for The Verge. “But until today, we hadn’t realized that people’s lives might also be at stake.”

“As reported by The Washington Post and CNET, the heads of NASA and the National Oceanic and Atmospheric Administration (NOAA) warn the issue could set back the world’s weather forecasting abilities by 40 years — reducing our ability to predict the path of deadly hurricanes and the amount of time available to evacuate,” Hollister reports.

“It’s because one of the key wireless frequencies earmarked for speedy 5G millimeter wave networks — the 24 GHz band — happens to be very close to the frequencies used by microwave satellites to observe water vapor and detect those changes in the weather,” Hollister reports. “They have the potential to interfere. And according to NASA and NOAA testimony, they could interfere to the point that it delays preparation for extreme weather events.”

Read more in the full article here.

The U.S. Senate approves Anti-Robocalling bill to combat ‘Daily Deluge’

In a vote of 97 to 1, the U.S. Senate voted to move forward with a bill named the "TRACED Act" to combat the surge of Robocalls that sometimes harass phone customers several times a day.

The bill which was introduced by Senators John Thune (R-SD) and Ed Markey (D-MA) would create an interagency task force which would hike fines that the Federal Communications Commission (FCC) can level against offenders, and extend the statute of limitations on penalties.

But most significantly the bill would pressure U.S. carriers to deploy call authentication systems such as STIR/SHAKEN. That technology marks genuine callers as "verified," allowing people to block or ignore anyone else.

 

Chinese Man pleads guilty for defrauding Apple out of 1,500 iPhones

“Over the span of two years, a Chinese national in Oregon sent devices that looked like iPhones to Apple, saying they wouldn’t turn on and should be replaced under warranty,” Andrew Selsky reports for The Associated Press. “He didn’t just submit a couple of the devices — he delivered in person or shipped to Apple around 3,000 of them. Apple responded by sending almost 1,500 replacement iPhones, each with an approximate resale value of $600. But the devices that Quan Jiang sent Apple were fake.”

“Jiang, 30, a former engineering student at a community college in Albany, Oregon, pleaded guilty in federal court Wednesday to trafficking in counterfeit goods, the U.S. Attorney’s office in Portland announced,” Selsky reports.

“Apple rejected 1,576 warranty claims associated with Jiang, Duffy said. The 1,493 claims that resulted in replacement iPhones being delivered by Applerepresented an $895,000 loss to the Cupertino, California-based company, Duffy wrote,” Selsky reports. “Jiang faces a maximum sentence of 10 years in prison, a $2 million fine or twice his proceeds, whichever is greater, when he is sentenced on Aug. 28. Under a plea agreement, the U.S. Attorney’s office will recommend a prison sentence of three years, at least $200,000 in restitution to Apple.”

Read more in the full article here.

You may have Missed:

Verified by MonsterInsights