When Hung Phi Nguyen went to work at the IBM Data Processing building in Bethesda last Friday morning, the day's date, May 28, was fixed in his mind. It was the second birthday of his youngest child, and Nguyen was anxious to get his paycheck so he could buy his son, Nam, a present on the way home.

But the day of celebration he had planned was shattered by an implausible turn of events. Just before 11 that morning, as Nguyen, a computer programmer, worked in his office, a masked man brandishing an automatic rifle opened fire in the main lobby. Nguyen, a former South Vietnamese army officer, called to his coworkers to run for cover. In the moments that he waited to make his own escape, a bullet struck and killed him.

Now, instead of honoring the gift of life on May 28, Nguyen's family will remember the day as one that took a life away. "It is something you do not understand," his father-in-law, Sung Van Dang, said yesterday. "But you have to accept."

As so often is the case with random acts of violence, the deaths of the two men killed by the gunman at IBM will forever remain a mystery to their relatives and friends. Nguyen and the other victim, 56-year-old Larry L. Thompson of Vienna, were quiet, successful men who shared an optimistic outlook on life and an interest in hard work and bettering the lot of their families.

They came from markedly different cultures and brought contrasting life experiences to their jobs in the glass-and-steel building where they worked. Nguyen, 40, who lived in a modest town house development on the northern rim of Silver Spring, had escaped war-torn South Vietnam when Saigon fell in 1975 and had steadily improved his family's circumstances since his arrival here that year. His eldest son, Quang, 7, and his daughter, Thanh Hn, 6, have adapted smoothly to this culture. They are top students at Westover Elementary School who look forward to swimming lessons and summer camp and art classes.

Thompson, who was gunned down near his third-floor office at IBM, was the all-American professional man. A native of Glennville, Ga., Thompson studied electrical engineering at Georgia Tech and was in a fraternity. He joined the army and was an instructor at Fort Belvoir. In 1960, he joined IBM as an operations analyst and worked his way up in the corporation, holding different positions involving computers and technical research.

"He was the type of person who, if you needed help, would volunteer to do anything he could to help you," said Louis Mogavero, who lives opposite Thompson on Springview Lane. "He was very friendly, very warm." Thompson's wife, Boots, and two sons, K. Larry and Kenneth W., were in seclusion over the weekend.

The irony of Nguyen's death was not lost on his relatives, who gathered at his corner town house over the weekend and placed a wreath on the front door. Nguyen had been a lieutenant in the South Vietnamese army, and was a passionate anticommunist.

"If he had died in Saigon during the war, you could understand," said Dang, his 67-year-old father-in-law who fled to the United States shortly after Nguyen and is now a social worker in Orange County, Calif. "But this is beyond understanding."

Nguyen was an only child whose parents, still living in Vietnam, learned of his death by cable Friday night. His life in the United States was the classic tale of a refugee who arrives here with nothing but makes ends meet through hard work and perseverance.

He and his wife, Phuong Dang, were both college educated. They had studied together at Dalat University in South Vietnam, and it was there that their romance blossomed. He was in Vietnam's Catholic minority, she was a Buddhist. They married in 1974, she converted to Catholicism, and they had their first son. His salary as a lieutenant was just enough to get them ahead.

When Saigon collapsed in 1975, Nguyen and his wife feared retaliation by the new regime and fled to the United States. Her father was editor of an avidly anticommunist newspaper in South Vietnam. He tried to stay until the end, but was forced out and barely escaped alive.

"We left everything behind. We had enough security there for a lifetime. We left everything we had but our pride," Dang said yesterday. "Here we had to start at the very bottom."

Nguyen began work here at the Hecht Company. He and his wife also took courses in computer programming. He got his first programming job at Howard University about two years ago. Then, one year ago, IBM hired him. His wife recently applied for a job there, too. Both of them, Dang said, had given up hope of returning to Vietnam and were preparing to become U.S. citizens.

Although the full-time IBM job improved Nguyen's income, he continued to work part-time at Hecht's to save money to buy a house. The little spare time that he had, said Dang, was devoted to his three young children. He spent some time fixing his car and working on his patio garden, but his children, Dang said, "were his hobbies."