about | help | code help+videos | done | prefs |
Write a method that returns the next pseudo-random number from a list of pseudo-random numbers. The 'randList' parameter will contain the list of pseudo-random numbers. The 'seed' parameter will indicate the current location in the list. The number in 'randList' at the location immediately after 'seed' is returned. However, 'seed' may be slightly greater than the highest index in 'randList' (by up to double the length of 'randList'). If 'seed' is greater than the highest index in 'randList' you must subtract the length of 'randList' from the seed and use the next number after that location. I did this in one line, but that is not required. Look at the test data for examples! may25_2018_APSL_Randomish([5, 1], 1) → 5 may25_2018_APSL_Randomish([5, 7, 4, 1, 8, 9, 12, 47, 3, 37, 33, 35, 18, 2], 5) → 12 may25_2018_APSL_Randomish([5, 7, 4, 1, 8, 9, 12, 47, 3, 37, 33, 35, 18, 2], 0) → 7 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy