Displaying random numbers

Questions regarding the Developer Edition's SuperEdit? This is the place!

Displaying random numbers

Postby Sam » Thu Jan 05, 2012 8:12 pm

Hi everyone,

So I am writing a code for a task, I am kinda stuck right now ... I need the code to displays random numbers starting from one digit in the first round of the game, and by the end of each round, these digits should increase by one.

starting with one number then 2 numbers then 3 numbers and so on till it reaches 6 digits. Moreover, these numbers should be random so that the player won't memorize them.

I want to tell SuperEdit to show random numbers of 3 digits and when the user successfully finishes the first round to start the second round and to increase the digits by one.


Any help?


Sam,
Sam
 
Posts: 2
Joined: Thu Jan 05, 2012 7:53 pm

Re: Displaying random numbers

Postby codegreen » Thu Jan 05, 2012 10:06 pm

Perhaps this will give you some ideas...

Code: Select all
on mouseUp
  global gRoundNumber
  if gRoundNumber is empty then put 1 into gRoundNumber else add 1 to gRoundNumber
  put randbo(gRoundNumber)
end mouseUp

function randbo seed
  enum expo = min(9, seed)
  get random(10^expo)
  repeat while len(it) < seed
    put random(10^expo) after it
  end repeat
  return char 1 to seed of it
end randbo

-Mark
codegreen
 
Posts: 1543
Joined: Mon Jul 14, 2008 11:03 pm

Re: Displaying random numbers

Postby Sam » Sun Jan 08, 2012 8:09 am

Thanks a lot for your reply,
I am gonna try it

Sam,
Sam
 
Posts: 2
Joined: Thu Jan 05, 2012 7:53 pm


Return to SuperEditing

Who is online

Users browsing this forum: No registered users and 1 guest