Clear Filters
Clear Filters

how to generate a random number between the range -50 to 50?

4 views (last 30 days)
a=rand(1,[-50,50])

Answers (1)

Andrei Bobrov
Andrei Bobrov on 28 Jul 2017
Edited: Andrei Bobrov on 28 Jul 2017
a = 10*(rand()-.5)
or integer namber
a = randi([-50,50])

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!