mardi 21 novembre 2017

Generate a random, symmetrical and consecutive integer sequence, without 0, in MATLAB

I need to generate random numbers between [-a, a], without 0. I can partly achieve this by doing randi(2*a + 1) - (a+1). Though, by doing so, the code might also return the value 0, which is what I want to avoid.

Can you please give me a lead? Thank you!




Aucun commentaire:

Enregistrer un commentaire