Josh. 14:2 Their inheritances were assigned by lot to the nine-and-a-half tribes, as the LORD had commanded through Moses.
Num. 26:52-6 The LORD said to Moses, "The land is to be allotted to them as an inheritance based on the number of names. To a larger group give a larger inheritance, and to a smaller group a smaller one; each is to receive its inheritance according to the number of those listed. Be sure that the land is distributed by lot. What each group inherits will be according to the names for its ancestral tribe. Each inheritance is to be distributed by lot among the larger and smaller groups.
Are these endorsements of gambling? Only by the loosest possible definition of the word. The sin in modern gambling lies in the throwing away of resources that are better put to productive use. Since there were no "losers" here - everyone got a parcel of land - and no associated vices, and since it was believed in ancient times that the lots thrown were controlled by the will of the deity, one fails to see how this can be equated with modern notions of gambling.