It's been a while since I did any solidity coding, but this one is easy.

I believe your contract is working fine.

BN { negative: 0, words: [ 3, <1 empty item> ], length: 1, red: null }

BN is "big number". Since a 256 bit uint doesn't work with a javascript "number" (floating point) type, the result is encoded in a BN data structure. (i.e. your random number is embedded in the words member of your returned object. (I think it's a literal 3 if I read that output right).

In your local javascript that tests your Solidity contract, just invoke toString on the BN object that is returned.

https://ethereum.stackexchange.com/questions/67087/how-to-use-bignumbers-in-truffle-tests


Even though you did not share your javacript code, I can tell that it is because you are not awaiting.

Calling contract code is asynchronous and you either call it with async.await or with then/catch

//in truffle console:

   randomContract=await RandomNumber.deployed()
   randomNumber=await randomContract.generateRandomNumber(rangeInteger)
   // this should print
   randomNumber.toString()