In most instances, this was simply a way of determining something impartially: Throughout the Old and New Testaments, we read about people casting lots when a decision had to be made.
However, the Bible does contain timeless principles for living a life pleasing to God and is filled with wisdom to deal with every situation, including gambling. Surprisingly, the Bible contains no specific command to avoid gambling.