HAYWARD -- Close to the geographic center of a city known as the "Heart of the Bay," Luciano Ruiz peered out the pickup window of a burger joint in what is, by one measure, the most racially diverse neighborhood in California.

"There's been a mix of people here ever since I grew up," said Ruiz, 18. "It's always been mainly Latino down here in South Hayward, but now you see more African-Americans, a lot more Asians. I've seen a little increase in Middle Eastern people."

The 2010 census shows a collection of census tracts in the Hayward flatlands as the most diverse in California and a microcosm of the state's likely future. Latinos are the largest group, but share the space with many other people. Multicultural churches, mosques and businesses are in walking distance.

Thirty-five miles away, in the Walnut Creek retirement community of Rossmoor, a cluster of census tracts reflect an older, less integrated California. About 90 percent of residents are white and less than 1 percent are African-American in the Bay Area's least-diverse neighborhood.

"It's probably accurate," said Rossmoor resident David Smith of the newly released statistics. "Our population is overwhelmingly white."

The Diversity Index is not a perfect measure of all the factors, from ethnicity to income, that can make a place diverse, but it is an indicator of an area's racial diversity. Devised by USA Today in 1991, it calculates the probability that two people randomly selected from a place are of a different race or ethnicity.

In a Hayward census tract just north of West Tennyson Road, the one that calculates as California's most diverse, a resident has an 89 percent chance of running into a neighbor who is of a different race or ethnicity. In contrast, a resident in the southern part of Rossmoor would have a 16 percent chance.

Smith does not know why his gated retirement community in Walnut Creek lacks the diversity of the wider East Bay, but age is one key factor: California's youngest generations are far more diverse than the oldest. Still, self-segregation also plays a role, he said. Smith said Rossmoor welcomes everyone older than 55 years old and is relatively affordable, but for the most part, it has been white people, and some Asians, who move there.

"I guess it's a question of familiarity and comfort," Smith said. "Where older people move to, often they choose places where they feel they would be most comfortable, with people that might be more like them. I know, for example, there is a large Chinese population, a large number of Koreans in Rossmoor, but for some reason, there are very, very few blacks."

Affluent, predominantly white communities such as Diablo, Alamo and Belvedere also rank among the lowest in the diversity scale, but the places with little racial diversity are not just the places that are mostly white. After Rossmoor, the second-least diverse neighborhood in the East Bay is Oakland Chinatown, which is about 90 percent Asian.

The index is not able to measure the variety of ethnicities and nationalities that fall within the main groups the census uses to categorize people. The least-diverse places in California include East Los Angeles and Calexico, which are both about 97 percent Latino.

In the Bay Area, however, a growing majority of the population lives in cities that rank high in racial diversity.

Hayward is the second most diverse city in the state, second to Carson, a suburb in Los Angeles County. Pittsburg, San Pablo, Richmond, East Palo Alto and Suisun City also make the top 10 most diverse of California cities. Close behind are Vallejo, Oakland and San Leandro, along with many of the East Bay's unincorporated areas. Even in Rossmoor, the population is more diverse than a decade ago.

Deanna Bogue, who has lived in the Southgate neighborhood near Hayward's Southland mall since shortly after the tract was built in the late 1950s, said it always has had a mix of people but the diversity increased gradually.

"It didn't happen overnight," Bogue said. "Just like anywhere, somebody puts a house up for sale, somebody looks at it and somebody buys it."

Southgate is among the top 15 most diverse neighborhoods of more than 8,000 census tracts across the state, and so are the nearby Hayward neighborhoods of Palma Ceia and the Jackson Triangle.

Bogue said the neighborhood has become less homogeneous, but residents still look out for each other.

Dave Stark of the Bay East Association of Realtors said the changing demographics beget further changes.

"What drives Hayward's diversity is Hayward's diversity," Stark said. "It's been very welcoming over the years. The city celebrates diversity, and there's a general acceptance of different cultures."

Local historian Frank Goulart said affordability has also long attracted a broad spectrum of people to parts of Hayward.

"If you want an honest answer, it's the cheap housing," Goulart said.

He said many of the homes in the city's most diverse tracts "were built like shacks."

Hayward leaders prize their city's diversity, but few would describe the neighborhood that happens to be most diverse as having a high a quality of life.

About a half-mile west of Mission Boulevard, the tract is a dense mix of large, boxy apartment buildings and single-family homes, laid out on roads studded with speed bumps. Most front yards are gated or fenced, and gang graffiti is common. To save money, day laborers crowd into one-bedroom apartments, and the census is likely to have missed many of them.

"Those buildings were all very ticky-tacky," Goulart said. "Built on a slab, then throw up the walls. They don't have central heat, only wall heaters. But people have got to have housing, and they have to go where they can."

For some, the increasing diversity of East Bay neighborhoods masks a more troubling phenomenon: Minorities who once concentrated in Bay Area cities such as San Francisco and Oakland are being priced out, leaving for suburban areas that are not much better off economically, said Nwamaka Agbo, organizer at the Oakland-based Ella Baker Center.

"For me, it is all-around bad," Agbo said. "Over the years, it's become really challenging for people of color to maintain residence and also maintain jobs in Oakland. People had to go elsewhere."

But for young people who grew up in Hayward, Pittsburg, San Leandro, Bay Point, Newark and other places that are among the most diverse, an integrated suburban neighborhood with a variety of people in it has become the norm.

"I think it does have a positive side," said Ruiz, the 18-year-old at the burger joint. "When I was young, people kept more to their own, more to themselves. I only kept to Latino and Hispanic people. But now everyone is starting to open up."

Staff writer Lisa Vorderbrueggen contributed to this report.