MATLAB Answers

How can I generate a random number that is negative or positive and between two other values?

601 views (last 30 days)
I need to write a function that generates two numbers that are between the negative and positive values of an integer. For example, if I call the function and input 7 it should generate two random numbers between -7 and +7. I can't figure out a way to use the randi function because the values I need can't be just integers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!