|
On 6/20/2012 12:22 PM, Twilighter wrote:
> Hi I need to test the rand fucntion
>
> but i get this error
>
> Error using ==> rand
> State must be a double scalar or the output of RAND('state').
>
> Error in ==> pn_test at 13
> rand('state',Key);
>
>
> this my Code what is wrong in there ?
>
> % read in key for PN generator
> file_name='_Key.jpg';
> Orig_key=double(imread(file_name))./256;
> Key = reshape(Orig_key,1,[]);
>
> % reset MATLAB's PN generator to state "key"
> rand('state',Key);
...
Well, it wouldn't appear that Key passed to rand() is a scaler given the
preceding code and unless the machinations performed match the
conditions of the output of a previous call to rand('state') then it
would seem pretty clear from the error message what you've tried to do
isn't legal...
And, what you're attempting is probably misguided at best, anyway...I
suggest a serious perusal of doc rand and the links therein,
particularly the reference at
<http://www.mathworks.com/help/techdoc/math/bsn94u0-1.html#bsvcr7h>
--
|