Jump to content
  • 0

buildin_rand: range (0) is to small. No randomness possible === setarray .Peco[0], 2811;         .size = getarraysize(.Peco); .@mid = .Peco[rand(.size)];


Dev KhayZia AZ

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.05
  • Content Count:  12
  • Reputation:   0
  • Joined:  11/22/24
  • Last Seen:  

 buildin_rand: range (0) is to small. No randomness possible

 

.@mid = .Peco[rand(.size)];

setarray .Peco[0], 2811;
        .size = getarraysize(.Peco);

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  950
  • Reputation:   180
  • Joined:  04/05/13
  • Last Seen:  

You need at least 2 array to random. (1 will error like you post)

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.05
  • Content Count:  12
  • Reputation:   0
  • Joined:  11/22/24
  • Last Seen:  

can you do it here 2 array

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   11
  • Joined:  12/16/11
  • Last Seen:  

Just tell what you want and we can try to help you.

If .size is initialized after the rand, it will rand(0), try this instead:

.@mid = .Peco[rand(getarraysize(.Peco))]; // else where in the code

OnInit: // inside the script but at end
setarray .Peco[0], 2811;
end;

If size is 1, rand(1) will give 0, which is first position, no error must be shown.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...