필터 지우기
필터 지우기

How to generate a new Key value

조회 수: 3 (최근 30일)
Elysi Cochin
Elysi Cochin 2017년 11월 3일
답변: Steven Lord 2017년 11월 3일
With a integer row vector (p1) and a randomly generated key using key = rand;
i wanted to generate a "newKey" (can we generate a single value?)
size of p1 = 1xn
size of key = 1x1
any methods can be used. Please can someone suggest some key-generation ideas or links how to do it or how it can be done.
  댓글 수: 4
Adam
Adam 2017년 11월 3일
편집: Adam 2017년 11월 3일
You aren't giving enough information on what properties you want for your key. e.g. You could just do
newKey = sum( p1 ) + rand;
or
newKey = prod( p1 ) + rand;
but neither of those will necessarily meet the properties you may want from a key.
Jos (10584)
Jos (10584) 2017년 11월 3일
Can you give a small example of the input and the expected output, and the relation between the two?

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2017년 11월 3일
If you're looking to create your own random number generator (where p1 is the state), here are two possibilities.
or
If you want something a bit more robust than the XKCD or Dilbert pseudorandom number generators, perhaps you want to implement your own PRNG. A linear feedback shift register may be suitable for your needs and shouldn't be too difficult to write in MATLAB.
If you're not looking to create your own random number generator, I think we need a lot more information about your task in order to be able to offer any useful suggestions. Start from the beginning, assume we know nothing about what you've been asked or told to do (because we don't) and explain in detail.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by